PrimeFaces commandButton不会导航或更新 [英] PrimeFaces commandButton doesn't navigate or update

查看:78
本文介绍了PrimeFaces commandButton不会导航或更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Primefaces使我的应用程序更加美观.我注意到p:commandButtonh:commandButton的工作方式不同.

I'am using Primefaces to make my app a little bit more beautiful. I noticed that p:commandButton and h:commandButton don't work the same way.

p:commandButton调用该方法,没有其他发生. h:commandButton调用该方法并返回导航.

The p:commandButton calls the method and nothing else hapens. The h:commandButton calls the method and returns a navigation.

在使用p:commandButton时,按下登录按钮后,我在重定向方面遇到了麻烦.该如何处理?

I have got trouble with redirecting after pressing the login button when using p:commandButton. How to deal with that?

我确实有一个更新参数:

I do have an update parameter:

<p:commandButton value="Login" action="#{login.login}" type="submit" update="msgs" />

推荐答案

<p:commandButton>需要以下条件之一才能正常工作:

<p:commandButton> needs one of the following to work correctly:

  • update属性以列出要重新呈现的组件ID(用于AJAX请求)
  • 属性ajax="false"可以正常,非ajax提交.
  • the update attribute to list id's of components to re-render (for AJAX requests)
  • the attribute ajax="false" to make a normal, non-ajax submit.

如果您都不选择该按钮,则默认情况下该按钮会执行AJAX请求,而不会提供用户界面反馈.

If you have neither, the button does per default an AJAX request with no UI feedback.

此外,当周围的<h:form>具有enctype属性时,我都无法使用这两个选项.

Additionally, I've had problems with neither option working when the surrounding <h:form> had an enctype attribute.

这篇关于PrimeFaces commandButton不会导航或更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆