1

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 expert 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...

4

1 回答 1

0

您可以将托管 bean 映射到会话范围。

实际上,“返回按钮”这个问题在 JSF 中很常见,也是框架的主要抱怨之一。

作为一种解决方案,您可以尝试像 Ajax 计时器这样的东西,它会不时更新您的托管 bean,避免使用后退按钮出现这个问题。

于 2009-11-24T16:59:19.637 回答