jsf 中的返回命令按钮
如何将后退按钮实现为通用的命令按钮? 对于后退按钮,我指的不是浏览器按钮,而是位于页面上某处的按钮。 并不总是可以使用 Post-redirect-get 模式。
传递按钮应该指向的每个位置的信息是非常不切实际的。
导航规则是否可能有一个保留关键字指向最后应用的导航规则?
how would one implement a back-button as a commandbutton that works universally? with back button i don't mean the browser-button, but rather a button that sits somewhere on the page. it is not always possible to use the Post-redirect-get pattern.
its quite impractial to pass around the information on every single where the button should point to.
is there maybe a reserved keyword for a navigation rule that points to the last navigation rule applied?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
在本例中,我使用带有属性
onclick="history.go(-1)"
的h:commandLink
。 它普遍有效。I use a
h:commandLink
with attributeonclick="history.go(-1)"
in this case. It works universally.我的第一个想法:
在每一个
等等; 将导航字符串存储在 bean 甚至堆栈中,然后后退按钮可以检索它并根据 faces-config.xml
第二个想法返回它。
但在反射时,您应该覆盖或使用过滤器来拦截导航命令并将它们推送到堆栈上。 然后后退按钮可以弹出导航,然后您就可以离开了。
My first idea :
on every
and etc; store the navigation string in a bean, or even a stack, and then the back button can retrieve it and just return that as per faces-config.xml
Second idea.
But on reflection you should override or use a filter to intercept the navigation commands and push them onto a stack. Then the back button can just pop the navigation off and away you go.
您可以使用:
该指令的作用与 alexmeia 所说的
onclick="history.go(-1)"
相同。You can use:
That instruction do the same as
onclick="history.go(-1)"
which alexmeia has said.我会将导航字符串存储在堆栈数据类型中,然后使用 stack.peek() 来显示您后面的站点,当单击它时,您将触发一个触发 stack.pop() 的操作事件
I would store the navigation string in a stack datatype and you use the stack.peek() to show which is the site behind you, and when its clicked you fire an action event that triggers the stack.pop()
我在选项卡视图中使用了“上一个”按钮,并且仅使用 PS 即可顺利导航 -
当我没有使用
return false;
并且单击上一个按钮时,它会停留在仅当前页面。 然而,添加return false
后它开始工作。I have used the "previous" button in my tab view and the navigation is working smoothly by just using
P.S.- When I did not use
return false;
and I clicked on the previous button, it stays on the current page only. However, after addingreturn false
it started working.