Hi,
sorry for the belated response. I'm facing the same problem in the
development. I am aware that a HTTP redirect requires one extra round trip
to client, but RequestDispatcher.forward or jsp:forward may bring problems
with browser reload. If a user fills in a form and pushes submit, one record
(e.g an order item) will be inserted in the database by a servlet or a jsp,
and the request is forwarded to another JSP(e.g. to show the order). At that
moment if the browser reload button is pressed, the formeer servlet or JSP
will be invoked again, which tries to insert the same record again in the
database. So I think HTTP redirect should be used to prevent such duplicate
data problem. Any comment?
regards
Dapeng
> -----Urspr�ngliche Nachricht-----
> Von: Craig R. McClanahan [SMTP:[EMAIL PROTECTED]]
> Gesendet am: Donnerstag, 30. Dezember 1999 23:36
> An: [EMAIL PROTECTED]
> Betreff: Re: Redirect or ??
>
> John McDonald wrote:
>
> > All,I have a question about what the best way to redirect a user may
> > be. I have an extensive web app that is presently based on servlets.
> > I'm "porting" this web app to JSP, and I'm going to use my servlet to
> > authenticate and "direct" the user. Once a user connects to the
> > servlet, authenticates, and I have their informaiton, what is the
> > best way to send the user to the JSP page. Should I use redirect, or
> > is there a better way? Any comments would be appreciated. John D.
> > McDonald
>
> Using a redirect would work, but that requires an extra round trip to
> the client's browser. For a one-time occurrence, this is no big deal,
> but would cause performance issues if you did it on every request.
>
> The RequestDispatcher.forward() call (added in the servlet API version
> 2.1) was designed for just this sort of purpose. In fact, I use it for
> all of my JSP-based apps like this:
>
> * JSP page has an input form to collect user data
>
> * The form is submitted to a servlet
>
> * The servlet performs whatever processing logic
> needed to satisfy the request, stores any results
> to be displayed in beans, and forwards control
> to a JSP page to show the results.
>
> This approach lets me use the MVC architecture approach (beans=Model,
> JSP pages=View, servlet=Controller) and separate my business logic from
> my presentation logic.
>
> Craig McClanahan
>
> ==========================================================================
> =
> 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
===========================================================================
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