I have a page that is filled with data some user inputed some hiddens that were passed. When they click a button such as more? or help? I do a sumbit to a new jsp. Once they choose an option from there I need to go back to the previous jsp. Is there anyway to keep all the values other than sumbitting all those to the new jsp and sending them back once I submit again?
Another is to store the data in the session for later retrieval. If you go that route be careful to manage the session data carefully and remove it when no longer needed.
Yet another approach -- for items such as help and hints and other information that isn't really part of the workflow -- is to not replace the main page with the display of the ancillary information at all.
Rather, you could display it another window, in an iframe in the current window, or (a technique I very often use) a floating div that appears above the workflow data. That way, your workflow is never interrupted and moving the data around becomes a moot point.
A better solution is to use something like Struts' ActionForm. It makes managing form data much easier. Especially if have a multi-page form or you are doing form validation.
Take a look at Struts in Action by Ted Husted, et al, for more info.
I won't argue the point about Struts being a behemoth! Especially if you are new to it. But it and other MVC frameworks do help build more maintainable web apps.
But for a simple app that will never grow beyond a couple of small forms, it's overkill.
Originally posted by Scott Johnson:
But it and other MVC frameworks do help build more maintainable web apps.
There are those, myself included, who would still disagree on that point. Following accepted practices and using a good web application structure make a web app (or any program for that matter) maintainable and extensible.
Large frameworks are not necessary to achieve that.
[ June 20, 2006: Message edited by: Bear Bibeault ]
Following accepted practices and using a good web application structure make a web app (or any program for that matter) maintainable and extensible.
I totally agree. No framework is required to build a maintainable and extensible application. But a good framework can help achieve those goals. (And a bad framework can make your life miserable. )