jsf 中的返回命令按钮

发布于 2024-07-15 07:26:04 字数 167 浏览 5 评论 0原文

如何将后退按钮实现为通用的命令按钮? 对于后退按钮,我指的不是浏览器按钮,而是位于页面上某处的按钮。 并不总是可以使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

过期情话 2024-07-22 07:26:04

在本例中,我使用带有属性 onclick="history.go(-1)"h:commandLink 。 它普遍有效。

I use a h:commandLink with attribute onclick="history.go(-1)" in this case. It works universally.

栀子花开つ 2024-07-22 07:26:04

我的第一个想法:

在每一个

<h:commandLink .....>

等等; 将导航字符串存储在 bean 甚至堆栈中,然后后退按钮可以检索它并根据 faces-config.xml

第二个想法返回它。

但在反射时,您应该覆盖或使用过滤器来拦截导航命令并将它们推送到堆栈上。 然后后退按钮可以弹出导航,然后您就可以离开了。

My first idea :

on every

<h:commandLink .....>

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.

痴骨ら 2024-07-22 07:26:04

您可以使用:

<p:commandButton onclick="window.history.back();"/>

该指令的作用与 alexmeia 所说的 onclick="history.go(-1)" 相同。

You can use:

<p:commandButton onclick="window.history.back();"/>

That instruction do the same as onclick="history.go(-1)" which alexmeia has said.

醉南桥 2024-07-22 07:26:04

我会将导航字符串存储在堆栈数据类型中,然后使用 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()

〃安静 2024-07-22 07:26:04

我在选项卡视图中使用了“上一个”按钮,并且仅使用 PS 即可顺利导航 -

 <p:commandButton value="Previous" id="PreviousOffer" onclick="window.history.go(-1);return false;"/>

当我没有使用 return false; 并且单击上一个按钮时,它会停留在仅当前页面。 然而,添加return false后它开始工作。

I have used the "previous" button in my tab view and the navigation is working smoothly by just using

 <p:commandButton value="Previous" id="PreviousOffer" onclick="window.history.go(-1);return false;"/>

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 adding return false it started working.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文