Re: Redirection
Andy Engle <[email protected]>
| Newsgroups | gmane.comp.java.sun.servlet |
|---|---|
| Message-ID | <[email protected]> |
Geeta Ramani <[email protected]> wrote: > Aasim: > > Sure, just redirect to "samePage.jsp?error=myError". At the top of > your samePage.jsp, simply check to see if > request.getParameter("error") is true and if so display a JavaScript > alert with the appropriate message.. Of course if you use Struts, > everything is easy..:) My $0.02: I did something similar with a PHP thing I've been working on, which should work basically the same with servlets. I set a session variable to be an "error flag", and then forwarded to the page that has the form the user submitted. From there I checked the error flag, and if true, display the error message. This is pretty much the same as what Geeta suggested, only using session variables instead of passing something along the query string. If you do it the session way, be sure to unset the session variable immediately after use, as you don't want the error message to show up every time the page loads. Andy ___________________________________________________________________________ To unsubscribe, send email to [email protected] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html