I am working with creating a report online.  There are two JSP pages: the
parameters.jsp (a form for inputting report dates, etc.), and report.jsp
(which queries the database shows the report).  There is also a custom tag
involved.  This tag exists on the parameters page, handles validation of the
report parameters, and, once validated, uses response.sendRedirect() to move
the user to the report page.

When working with just the two JSP pages and the tag, everything works fine.
After the form is valid, the redirect gets sent, and the report shows.  All is
happy and good.

Almost.

The problem arises when I attempt to enforce style, security, etc. using a
servlet as a controller which includes pages programmatically.  The servlet
logic looks like this:
 include page header
 include parameter form
 include page footer

When accessed this way, the sendRedirect() method in the tag in parameters.jsp
does not work.  I get no "IllegalStateException", as I ought if the response
was already commited.  I get no "IOException".  The redirect just never
happens.  If I skip the servlet and go directly to the JSP pages, all works
again.

The other odd thing that happens when using the controller servlet is that the
content of parameters.jsp is not written when the response.sendRedirect() is
called.  The header is written and the footer is written, but no content comes
back from parameters.jsp.  When the sendRedirect() is called, parameters.jsp
generates no content whatsoever, but the redirect is not successful.

I hope this makes sense.  It's a little hard to explain succinctly.

Anyone have any ideas where I should look?  Why would a redirect in a tag work
when the JSP the tag is in is accessed directly, but NOT work when the JSP
page is included by a servlet?

Thanks for any ideas,

Tim

-------------
 Tim Keuning
-------------

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to