JSF2.0 PrimeFaces 导航问题
我现在导航也有问题。我有 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
忘记我之前的回答了,我没有仔细阅读你的问题。可能发生的情况是您的
调用失败。如果它(无提示)失败,那么该错误将导致 JSF 自动导航回同一页面。将其添加到页面的某个位置,以便您可以看到框架可能提供的任何有用的错误 FacesMessages:
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:
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 forCar
values?