Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
764 views
in Technique[技术] by (71.8m points)

jsf - PrimeFaces commandButton doesn't navigate or update

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.

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

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" />
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

  • 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.

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...