tomcat 5 using redirect

  • Thread starter mark sullivan via JavaKB.com
  • Start date
M

mark sullivan via JavaKB.com

Hi,
I'm using tomcat 5 with the jsp 2.0 specification and having an extreme
problem using redirects. An example would be like this:

<form action="itself" method="post">
//print some html
<%
if{//some condition satisfied}
//Access granted and redirect to new page
//This, the if statement does success
response.sendRedirect("new.jsp");
}
%>
</form>
Unfortunately this does not some to work, it redirects to itself. Does
anyone know does an issue arise for tomcat 5.0 using redirects? I had the
application running under tomcat 4.1 but needed to move to 5.0 to use tiles.
Mark.
 
S

shakah

Are you trying to POST the form to new.jsp when the condition is
satisfied, or trying to redirect to new.jsp instead of displaying the
form? If the former you can do something like:
<form action="<%=condition ? "new.jsp" : "itself"%>" method=POST>

If the latter, you can run into problems if you output too much HTML
before the call to sendRedirect(), as the headers might have already
been sent with the first block of the HTTP response. Either checking
the condition earlier or increasing the output buffer size can help in
this case.
 

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

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,805
Latest member
ClydeHeld1

Latest Threads

Top