I just edited this post completely, because I have figured out the problem, but still need help with the solution.
My JSP pages check for 2 session attributes and a request parameter (gotten through query string of url), to be present.
The request parameter, named "snr", is sent to a servlet which checks to see if the value of snr is in the database.
If the snr value is not found, the servlet is supposed to redirect to PageNotFound.jsp using the response.sendRedirect method. But it doesn't work, the redirect method doesn't execute.
Here's what I just realized though, the reason the redirect method doesn't work in one particular servlet is because I'm using <jsp:include> in the jsp page to execute that servlet, instead of executing the servlet directly. Jsp's that have a form within them, and the action attribute set to a servlet, work just fine. The redirect executes.
JSP page
<% try {
String snr = request.getParameter("snr");
if(snr == null) snr = "";
%>
<jsp:include page="go.myservlet">
<jsp:param name="snr" value="<%=snr%>"/>
</jsp:include>
<% } try
catch(Exception e) {}
%>
Including the servlet in this fashion is not allowing the response.sendRedirect to execute, I'm assuming because doing it this way means the response has already been committed?
But I really do need the logic in the JSP example above. How else can I work around this problem though?
Edited by: webnotick on Jan 26, 2010 12:15 PM