File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Maintain Data Across Errors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Maintain Data Across Errors" Watch "Maintain Data Across Errors" New topic
Author

Maintain Data Across Errors

Dave Wingate
Ranch Hand

Joined: Mar 26, 2002
Posts: 262
I was wondering if anyone could suggest a good strategy for maintaining user entered data across, say, validation errors.

My goal is that when a user submits a form to a servlet and something goes wrong, I would like to redisplay the page that the user submitted the form from. I can accomplish this through response.sendRedirect(), but the user's data is gone. It appears that I have a new request object when I use sendRedirect().

Is there a good way to maintain the user's submitted data across multiple invocations of the same JSP?


Fun programming etcetera!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

Rather than a redirect, perform a dispatcher forward and the submitted parameter values will be available when re-building the page.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maintain Data Across Errors
 
Similar Threads
JSP/form/servlet - session persistence ?
To: John Carnell, Re: Method Overrides
JSTL Weblogic
link css style sheet
How can I clear error messages? Not sure if I'm doing this right.