JSF后退按钮 [英] JSF Back Button

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

问题描述

我该如何建立一个将用户导航到上一页的链接(即与单击浏览器一样)?

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

谢谢.

推荐答案

要点:仅记住请求URL或上一页的JSF viewId,以便可以在输出或命令链接的href或值中使用它.有多种方法可以实现它,具体取决于您实际上如何浏览页面以及要如何实现"jsfish".您可以通过h:outputLink中的f:param将其作为请求参数传递,或者可以通过h:commandLink中的f:setPropertyActionListener将其设置为bean属性,或者可以创建一个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天全站免登陆