JSF2.0 PrimeFaces 导航问题

发布于 2024-11-16 23:02:42 字数 486 浏览 1 评论 0原文

我现在导航也有问题。我有 2 个数据表,一个位于常规 Facelets 页面中,另一个位于对话框中。 两者都有相同的代码:

<p:commandButton
   value="Show car"
   ajax="false"
   action="showCar?faces-redirect=true">
   <f:setPropertyActionListener value="#{car}" target="#{carBean.car}" />
</p:commandButton>

我也尝试添加 process="@this" 但没有成功。

问题是,虽然导航适用于facelets页面内的commandButton,但它不适用于对话框内的按钮。看来点击后当前页面会重新加载。 用 a 替换它也没有帮助。

以前有人经历过类似的事情吗?这可能是对话框的问题吗?

谢谢并致以最诚挚的问候, 罗伯特

I have a problem with navigation too right now. I have 2 dataTables, one is located within a regular facelets-page, the other one is located in a dialog.
Both have the same code:

<p:commandButton
   value="Show car"
   ajax="false"
   action="showCar?faces-redirect=true">
   <f:setPropertyActionListener value="#{car}" target="#{carBean.car}" />
</p:commandButton>

I also tried adding process="@this" without success.

The problem is, while the navigation works for the commandButton inside the facelets-page, it doesnt work for the button inside the dialog. It seems that the current page is reloaded after the click.
Replacing it with a doesn't help either.

Has anybody experienced something like this before? Could this be an issue with the dialog?

Thanks and best regards,
Robert

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

非要怀念 2024-11-23 23:02:42

忘记我之前的回答了,我没有仔细阅读你的问题。可能发生的情况是您的 调用失败。如果它(无提示)失败,那么该错误将导致 JSF 自动导航回同一页面。

将其添加到页面的某个位置,以便您可以看到框架可能提供的任何有用的错误 FacesMessages:

<p:messages
    id="messagesForDebugging"
    showDetail="true"
    autoUpdate="true" />

autoUpdate 将导致它闪现由全局 Ajax 请求生成的消息。

您可能还想在 carBean.setCar() 方法中添加一条日志记录语句,以确保它成功设置该值。如果失败,那么您可能需要为 Car 值提供自定义转换器?

Forget my previous answer, I didn't read your question carefully. What might be happening is a failure in your <f:setPropertyActionListener> call. If it is (silently) failing then the error will cause JSF to automatically navigate back to the same page.

Add this to your page somewhere so you can see any helpful error FacesMessages that may be provided by the framework:

<p:messages
    id="messagesForDebugging"
    showDetail="true"
    autoUpdate="true" />

The autoUpdate will cause it flash up messages generated by global Ajax requests.

You may also want to put a logging statement in your carBean.setCar() method to make sure that it is successfully setting the value. If it is failing then maybe you need to provide a custom converter for Car values?

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