Hi there,

Little confused about something with JSP and the forward tag. I am using
the Model 1 approach at this time. At the VERY top of a JSP page, I have
some scriplet that may be something like:

<%
  if( request.getParameter("command") != null )
  {
    somebean.enroll(request);
%>
    <jsp:forward page="/path/somepage.jsp" />
<%
  }
  else
    somebean.init();
%>

That seems to work ok. If the command parameter exists, it calls a bean
method, then forwards to some other page. Yet, from what I read in the
spec, once the servlet the JSP page is turned into gets the request, it
starts the response buffer and you CANT forward to another page at that
point. I have seen an adverse affect by forwarding to a page in a javabean,
which ends up putting part of the first page as well as the NEW page
forwarded to in the response, and thus the returned page looks funky.

So a few things come to mind here. First..is what I did above ok (assuming
its done before ANY html tags are inserted)? Secondly, why cant we "clear"
the response buffer at some point so we CAN forward at any point in a JSP
page (or javabean or servlet)? Why is that forbidden? You clear it, forward
to a new page, and have that page fill it up.

Something related for forwarding but not to the above..is there any way
when forwarding to another page to get the web browser URL to show it in
the line? Its nice that you can directly jump to another server page
without making a roundtrip to the browser with the response.sendRedirect(),
but, I would like the browser URL line to reflect the change of the URL.
Seems like when you forward, that doesnt occur. Its hitting one page, and
that page on the server forwards to another which fills in the response. I
understand why it doesn't work, but is there some way to make it
work..where you can set a header or something the browser recongizes to
update its URL line?

Thanks.

Kevin Duffey
Software Engineer
[EMAIL PROTECTED]

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to