JSF commandButton

Splash Forums PrettyFaces Users JSF commandButton

This topic contains 7 replies, has 2 voices, and was last updated by  Lincoln Baxter III 11 years, 2 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • #17803


    Hey we have recently begun experimenting with pretty faces in our project and it has worked out well. One thing we have encountered though is once we are on a pretty faces page (i.e. /hobbies/cars/civic) and we have a JSF command button, the action on the command button will not get called. Looking at the page source, it seems the form gets posted back to the same page. Since its being posted back to the same page, pretty faces will handle the request and it is never passed back through to jsf. I would assume this is a problem that would be faced by many developers but may be wrong. Are there any workarounds, or did I miss something in the documentation?



    This doesn’t sound like normal behavior. Could you please post your relevant versions, prettyfaces, jsf, appserver — and also post some code and configuration (or a full example project would be best.)





    Thanks for the fast response. I apologize, I think I found the solution. I used the onPostback attribute on the action element (set to false) and now the pages seem to work like expected. So if this is set to true, it doesn’t seem to pass the action to JSF?


    What version of PrettyFaces are you using? That sounds backwards.

    <action> #{bean.action} </action> — should trigger the action on PostBack

    <action onPostback="false"> #{bean.action}</action> — should not trigger the action on PostBack

    This should have no affect on command button action methods (<h:commandButton action="#{otherBean.otherMethod}" />), unless of course your action method invokes navigation – this would prevent further JSF processing (including any command actions) for the current request



    Lincoln, yes we use command buttons that invoke navigation. Although, isn’t this the default case with command buttons using the action attribute (without immediate attribute)? The method in the action attribute on the command button didn’t seem to be invoked when the onPostback attribute was set to true. And come to think about, we are also using command links with the immediate attribute set to true, and those as well didn’t work (again, these invoke navigation.) After setting a break point on the command buttons action method, it will only be called once the onPostback attribute is set to false. I apologize, I am still new to pretty faces.


    Could you please send a test-case that I could try? To see what you are experiencing. Also, I still need your versions/code/config.



    We are using JSF 1.2, as well as Spring (3.0.3.RELEASE) and have registered the SpringBeanFacesELResolver in the faces-config.xml.

    version: prettyfaces-jsf12-3.1.0


    <url-mapping id="viewItem" >
    <pattern value="/location/details/#{ itemId }" />
    <action onPostback="false">#{locationCrud.detailSetup}</action>

    locationCrud is a bean registered in Spring application context (normal POJO).

    /location/detail.xhtml (stripped down)

    <ui:composition template="/templates/skeleton.xhtml">
    <ui:define name="listing">
    <ui:include src="list.xhtml" />
    <ui:define name="display">
    <h:commandButton action="#{locationCrud.editSetup}" value="#{msg.btnEdit}">
    <f:setPropertyActionListener target="#{jsfService.itemId}" value="#{locationCrud.item.uuid}" />


    Hmm… that’s very interesting.

    I haven’t heard of anyone else complaining about this. Could you post your locationCrud.detailSetup function?


Viewing 8 posts - 1 through 8 (of 8 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.