问题
I have a web application that is made with Java+Struts.
There is a form that when is submited it executes an Action that shows the results of the search.
Since here, all ok.
What I need is to put a link in the results page to come back to the form without erasing the search parameters.
I've put a link that goes back to the form page, but allways erase the search parameters.
I've thinking about saving and restoring this parameters to the java session, or adding the parameters to the url (like: /myForm?param1=1¶m2=2¶m3=3) but I think that maybe there is a better way to do this.
There is any way to do this with struts?
Pd. The struts version is 1.3.8
回答1:
Just add the parameters (/myForm?param1=1¶m2=2¶m3=3) to the button url that leads back to the search form. Then populate the fields using the parameters. No need to use session variables.
Unless i'm missing something...
来源:https://stackoverflow.com/questions/9428248/how-to-come-back-to-form-without-reset-the-values