JSF 后退按钮 [英] JSF Back Button

查看:30
本文介绍了JSF 后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建一个链接,让用户返回一页(即与单击浏览器返回相同)?

How do I make a link which navigates the user back one page (i.e. same as clicking browser back)?

谢谢.

推荐答案

切入正题:只要记住上一页的请求URL或者JSF viewId,这样就可以在输出/commandlink的href或者value中使用了.有几种方法可以实现它,具体取决于您实际浏览页面的方式以及您想要实现它的jsfish"方式.您可以通过 h:outputLink 中的 f:param 将其作为请求参数传递,也可以通过 f:setPropertyActionListenerh:commandLink 中,或者您可以创建一个 PhaseListener 记住 viewId 并使用导航案例,或者您可以获取 -不太可靠- JavaScript history.go() 函数.

To the point: just remember the request URL or the JSF viewId of the previous page so that you can use it in the href or value of the output/commandlink. There are several ways to achieve it, depending on how you're actually navigating through the pages and how "jsfish" you want to achieve it. You could pass it as a request parameter by f:param in h:outputLink, or you could set it as a bean property by f:setPropertyActionListener in h:commandLink, or you could create a PhaseListener which remembers the viewId and make use of navigation cases, or you could grab the -much less reliable- JavaScript history.go() function.

这篇关于JSF 后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆