Error 500: ERROR: Cannot forward. Writer or Stream already obtained. Error

J

JavaQueries

hi

i m unable to fugure out y I m getting this error

it's a suggestion page and on submitting this page I have to reload
the page but with status of the page (requires approval) in form of
url

earlier say few days back , it was working fine , i had absolutely no
issues in this

since 2-3 days everytime i submit the page , i m getting the error
Error 500: ERROR: Cannot forward. Writer or Stream already obtained.
Error 500

my code is listed below

pls help

<%@ include file="../includes/sessionChecker.jsp"%>
<%@ page isThreadSafe="false" errorPage="../html/messError.jsp" %>
<%@ page import="java.io.*,java.util.*,java.sql.*" %>
<%@ page import="com.syntaxsoft.util.*" %>
<%@ page import="com.syntaxsoft.util.DateUtil" %>
<%@ page import="com.syntaxsoft.admin.*" %>
<%@ page import="com.syntaxsoft.employee.*" %>
<%@ page import="com.syntaxsoft.db.*" %>
<%@ include file="../includes/cssJsInclude.jsp"%>

<%@ taglib uri="QuinnoxTags" prefix="QuinnoxTags" %>
<html>
<head>
<title>Suggestions</title>
<meta http-equiv="Content-Type" content="xls/html;
charset=iso-8859-1">
<link href="../STYLESHEET/stylesheet.css" rel="stylesheet"
type="text/css">
</head>

<body>
<%!
Table sqltab;
SqlBuilder sqlObj;
%>
<%
String dofc = "",subject="",suggestion = "",docsrno="",actions="";
String pick_button = "",locateid = "",employid="",url="";
String employeeid="";
String tabname=" ";

boolean success = false;

ResultSet rs= null;
%>
<%
employid = (String) session.getAttribute("empid");
locateid = (String) session.getAttribute("locationid");

Employee empobj = Employee.getEmployee(employid);

DateUtil dateform = new DateUtil(locateid);

actions = request.getParameter("actions");
pick_button = request.getParameter("DECISION");
System.out.println("ACTION"+actions);
System.out.println("pick_button"+pick_button);
%>
<body>
<%
if(actions.equals("create")){

if(pick_button == null){
%>
<form name="form1" method="post" action="../HRFiles/Suggestions.jsp">

<input type="hidden" name="actions" value="<%=actions%>">
<div class="page_heading">Suggestion Box</div><br>

<table>
<tr><th>From:</th><td><%=empobj.getFullName()%>&l t;/td></tr>
<tr><th>Dated:</th><td><%=dateform.getToday()%>&l t;/td></tr>

<tr><th>Subject</th><td><QuinnoxTags:TextBox type="text"
name="subject" maxLength="65" required="true" value=" "
label="Subject"/></td></tr>




<tr><th colspan="2">Suggestion:</th></tr>
<tr><td colspan="2"><QuinnoxTags:TextBox name="suggestion"
type="textarea" cols="60" rows="13" required="true" value=" "
label="Suggestion" maxLength="250"/></td></tr>
</table><br>
<table>
<tr>
<td align="right">
<input type="submit" name="DECISION" value="Submit" class="button">
</td>
</tr>
</table>

<input type="hidden" name="empid" value="<%=employid%>"

<jsp:include page="../masters/flow.jsp" flush="true">
<jsp:param name="CREATOR" value="true"/>
<jsp:param name="TABNAME" value="SUGGESTION_WKFLOW"/>
</jsp:include>

<!-- <table>
<tr><td align="right"><input type="submit" name="submit"
value="Submit" class='button'></td></tr>
</table>-->

</form>
<%
}
else{

dofc = dateform.getTodayMillis()+"";
subject = request.getParameter("subject");
suggestion = request.getParameter("suggestion");
tabname =request.getParameter("TABNAME");
// insert into SUGGESTIONS

// generate key
IDs idObj = IDs.getIDs();
docsrno = idObj.getId("SUGGESTIONID");

sqlObj=new SqlBuilder("SUGGESTIONS");
sqlObj.setColumn("DOCSLNO",docsrno);
sqlObj.setColumn("EMPID",employid);
sqlObj.setColumn("DOFC",dofc);
sqlObj.setColumn("DOFCZONE",locateid);
sqlObj.setColumn("SUBJECT",tabname);
sqlObj.setColumn("SUGGESTION",suggestion);
// System.out.println("empid is "+request.getParameter("empid"));
System.out.println("empid is "+employid);
success = sqlObj.set(SqlBuilder.INSERT);
%>
<jsp:include page="../masters/flow1.jsp" flush="true">
<jsp:param name="DECISION"
value="<%=request.getParameter(com.syntaxsoft.admin.WorkFlow.DECISION)%>"
/>
<jsp:param name="empid" value="<%=request.getParameter(\"empid\")%>"
/>
<jsp:param name="VIEWLEVEL"
value="<%=request.getParameter(com.syntaxsoft.admin.WorkFlow.VIEWLEVEL)%>
" />
<jsp:param name="VIEWERID"
value="<%=request.getParameter(com.syntaxsoft.admin.WorkFlow.VIEWERID)%>"
/>
<jsp:param name="COMMENTS"
value="<%=request.getParameter(com.syntaxsoft.admin.WorkFlow.COMMENTS)%>"
/>
<jsp:param name="DOCSLNO" value="<%=docsrno%>"/>
<jsp:param name="CREATOR" value="true"/>
<jsp:param name="TABNAME"
value="<%=request.getParameter(\"TABNAME\")%>" />
<jsp:param name="MASTER_TABLE" value="SUGGESTIONS" />
</jsp:include>
<jsp:include page="../includes/redirectInclude.jsp" flush="true">
<jsp:param name="url"
value="../HRFiles/ViewSuggestion.jsp?flag=empview" />
</jsp:include>
<%
} // end of if(pick_button == null)
} // end of if(actions == create)


if(actions.equals("select")){

rs = sqltab.select("select * from SUGGESTIONS");

if(rs.next()){
%>
<div class="page_heading">List of Suggestions</div><br>

<table>
<tr>
<th>Employee Id</th>
<th>Employee Name</th>
<th>Suggestion Date</th>
<th>Subject</th>
</tr>
<%
do{
docsrno = rs.getString("DOCSLNO");
employeeid = rs.getString("EMPID");
dofc = rs.getString("DOFC");
subject = rs.getString("SUBJECT");

Employee empobj1 = Employee.getEmployee(employeeid);

url = "../HRFiles/Suggestions.jsp?actions=view&docsrno="+docsrno;
%>
<tr>
<td><a href="<%=url%>"><%=employeeid%></a></td>
<td><a href="<%=url%>"><%=empobj1.getFullName()%></a></td>
<td><a href="<%=url%>"><%=dateform.getDate(dofc)%></a></td>
<td><a href="<%=url%>"><%=subject%></a></td>
</tr>
<%
}while(rs.next());
} // end of if
} // end of if(actions == select)


if(actions.equals("view")){
docsrno = request.getParameter("docsrno");

rs = sqltab.select("select * from SUGGESTIONS where
DOCSLNO='"+docsrno+"'");

if(rs.next()){
do{
docsrno = rs.getString("DOCSLNO");
employeeid = rs.getString("EMPID");
dofc = rs.getString("DOFC");
subject = rs.getString("SUBJECT");
suggestion = rs.getString("SUGGESTION");

}while(rs.next());
} // end of if()

Employee empobj2 = Employee.getEmployee(employeeid);
%>
<div class="page_heading">Suggestion Box</div><br>

<table>
<tr><th>From:</th><td><%=empobj2.getFullName()%>& lt;/td></tr>
<tr><th>Dated:</th><td><%=dateform.getDate(dofc)%> ;</td></tr>
<tr><th>Subject</th><td><%=subject%></td>&l t;/tr>
<tr><th colspan="2">Suggestion:</th></tr>
<tr><td colspan="2"><textarea name="suggestion" cols="70" rows="10"
readonly><%=suggestion%></textarea></td></tr>
</table><br>

<table>
<tr><td colspan="4" align="right"><a
href="javascript:history.back()">Back</a></td></tr>
</table>
<%
} // end of if(actions == view)
%>
</body>
</html>


rgds
 
J

John C. Bollinger

JavaQueries said:
hi

i m unable to fugure out y I m getting this error

it's a suggestion page and on submitting this page I have to reload
the page but with status of the page (requires approval) in form of
url

earlier say few days back , it was working fine , i had absolutely no
issues in this

since 2-3 days everytime i submit the page , i m getting the error
Error 500: ERROR: Cannot forward. Writer or Stream already obtained.
Error 500

The error message does not make sense. It is permitted to perform a
forward after obtaining a response's Writer or Stream -- provided that
the response has not yet been committed. The defined behavior is to
clear anything previously written to the response. I don't know whether
your JSP container is actually buggy, or whether this particular error
message is just imprecise.
my code is listed below

Not all of it. In particular, I didn't find any place in the code where
you actually _perform_ a forward. Several includes, but they're
different. Speaking of includes, however, it is possible that you would
run into trouble trying to perform a forward inside an included
resource. Do you have a stack trace to go along with the error? From
the container's log, for instance? That would help you find the exact
place where the error occurs.

[...]
<jsp:include page="../includes/redirectInclude.jsp" flush="true">

Warning: JSP does not permit you to redirect the response from inside an
included resource. That might or might not have anything to do with the
problem you reported, however, and it might or might not be something
that includes/redirectInclude.jsp attempts to do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top