JSF 1.2 Go Back hyperlink
I have two forms. On Form 1, I have this screen layout:
<detail section>
hyperlink 1
hyperlink 2
etc
<detail section>
When I click a link on Form 1, for example, hyperlink 1, this takes me to Form 2. From Form 2, I have a link called "Go Back" to go back to Form 1. Usually, I would just use
history.back(); or
history.back(-1);
to navigate back. However, doing this means JSF resets all my form's values when I get back to Form 1 from Form 2. I want to return to the previous Form 1's view i.e. showing the detail section with data as opposed to a blank detail section.
I have also tried this - for each hyperlink in the detail section on Form 1, I have this code:
<h:outputLink value="two.jsf">
And in Form 2, I have this code:
<h:outputLink value="two.jsf">
The above parameters will be passed back to Form 1 for processing. While this is working, I'm not sure if this is the best way to do it with JSF 1.2.
Any exper开发者_开发技巧t here know of a better (more robust) method of creating a "Go Back" button? Example demo codes would be greatly appreciated as I have been stuck on this one for about a week now...
You may map your managed bean with the session scope.
Actually, this issue with the "back button" is common place in JSF, and is also one of the framework main complaints.
As a solution, you may try something like an Ajax timer which will update your managed bean from time to time, avoiding this problem with the back button.
精彩评论