4 Replies Latest reply on Jan 11, 2010 4:31 PM by daxxy

    Diference between h:commandButton and s:button?

      Hi All,


      Would like to know in detail about the functionality, how h:commandButton and s:button works?


      have seen the details here


      http://docs.jboss.com/seam/2.0.1.GA/reference/en/html_single/#d0e4817



      but i am facing some problem while persisting and merging JPA data while using s:button where as if i change s: button to h: commandButton everything works fine.


      i get below mentioned error when i use s: button



      javax.ejb.EJBTransactionRolledbackException: org.hibernate.PropertyValueException: not-null property references a null or transient value:



      where as i tried passing same values which i had passed with h:commandButton


      i want to pass some value from my form to action class which i am getting from another form2 by using



      #{param.myValue}



      now i read h:commandbutton doesn't sopports f:param value so is there any other work around to pass such value



      Please guide.

        • 1. Re: Diference between h:commandButton and s:button?
          nickarls

          s:button doesn't submit. Tried using a commandlink with params?

          • 2. Re: Diference between h:commandButton and s:button?

            Thanks for responding Nicklas,


            It helps.

            • 3. Re: Diference between h:commandButton and s:button?

              Hi,
              if I use a h:commandLink with parameters it seems like no parameters are passed to the page.


              This is my personEdit.xhtml


              <h:commandButton id="save" value="Salva"
                   action="#{personHome.persist}"  styleClass="green left" >
                        <f:param name="comeBack" value="#{personHome.comeBack}"/>
              </h:commandButton>




              In personHome.java i put




              @RequestParameter("comeBack")
              private String comeBack;



              with getters and setters;


              In pages.xml




                   <page view-id="/personEdit.xhtml" conversation-required="true" no-conversation-view-id="/errorConversationExpired.xhtml">
                        <navigation from-action="#{personHome.persist}">
                             <rule if-outcome="success">
                                  <end-conversation if="#{conversation.nested}" before-redirect="true"/>
                                  <redirect view-id="/visitEdit.xhtml" />
                             </rule>
                        </navigation>
              ...
              </page>



              If I use the s:button the redirection is working fine, but I got validation errors since the form is not correctly submitted.
              Anyone can help giving some hint?


              • 4. Re: Diference between h:commandButton and s:button?
                daxxy

                You didn't use h:commandLink you used h:commandButton.


                f:param does not work with h:commandButton, but don't ask me about passing parameter using h:commandButton because I'm still trying to figure it out!


                I read somewhere that h:commandButton can use f:param in JSF 2.0.