您可以使用 JSF faces-config 导航控制浏览器后退按钮吗
您可以使用 JSF faces-config 导航控制浏览器后退按钮吗?当在浏览器上按下后退按钮时,希望使用如下所示的导航来控制要显示的页面:
<navigation-rule>
<from-view-id>/pageThree.xhtml</from-view-id>
<navigation-case>
<from-outcome>back</from-outcome>
<to-view-id>/pageOne.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
Can you control browser back button using JSF faces-config navigation? When the back button is pressed on browser would like to use navigation like the following to control what page to display:
<navigation-rule>
<from-view-id>/pageThree.xhtml</from-view-id>
<navigation-case>
<from-outcome>back</from-outcome>
<to-view-id>/pageOne.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,你不能。 HTML/JS 已经不可能做到这一点,因此 JSF 在这里无法为您做太多事情。
最好的选择是根据某些 JS/ajax 条件,有条件地在 pageOne.xhtml 中显示 pageTwo.xhtml 的内容。这样浏览器历史记录中就没有针对 pageTwo.xhtml 的 GET 请求。
下面是一个使用普通 JS 的基本启动示例:
with
使用 JSF 2.0 ajax 和
rendered
属性这也很容易。No, you can't. It's already not possible with HTML/JS, so JSF can't do much for you here.
Your best bet is to conditionally display the content of pageTwo.xhtml in pageOne.xhtml, based on some JS/ajax condition. This way there's no GET request on pageTwo.xhtml in the browser history.
Here's a basic kickoff example with plain JS:
with
This is also easy with JSF 2.0 ajax and the
rendered
attribute.这是一种可能的解决方案: dojo.back 和 jqueryTools
Here is one possible solution : dojo.back and jqueryTools