5 Replies Latest reply on Jan 24, 2007 5:35 PM by svadu

    h:commandButton requires s:conversationId to work properly

      Hi all,

      From what I understand conversation id is propagated across post requests. I have a case where I visit a page via s:link (all participating beans are conversation scoped and the action in the link has @Begin(join=true) ):

      <s:link id="editLnk" value="#{message['edit']}" action="#{regionAction.submitEditGisArticle}"
       rendered="#{user.admin}" styleClass="texttoolbar" />


      On the resulting page I have a h:form with a h:commandButton however when I click the button apparently a new conversation started for some reason (which causes RequiredException as a result because some beans in the previous conversation are not present in the new conversation). The only way to avoid starting the new conversation is to put s:conversationId inside the h:commandButton and this works:

      <h:commandButton id="submitBtn" value="#{message['save']}"
       action="#{articlesHandler.submitEditedGeneralArticle}" >
       <s:conversationId/>
      </h:commandButton>


      Am I missing something? Why the conversation isn't propagated with the POST request this time?

      Thanks in advance,
      Siarhei Dudzin

        • 1. Re: h:commandButton requires s:conversationId to work proper
          pmuir

          I would suggest

          1) Create a simple example of this behaviour
          2) Post it

          - the behaviour you describe is wrong BUT does work.

          • 2. Re: h:commandButton requires s:conversationId to work proper
            mariuszs

             

            <s:conversationId>

            Add the conversation id to an output link (or similar JSF control). Facelets only.


            Why this tag is facelets only? Facelests version of tag h:commandButton need conversationId added?

            • 3. Re: h:commandButton requires s:conversationId to work proper
              pmuir

              No, it just means that the (wiring) code hasn't been written for JSP. You can acheive the same with

              <f:param name="conversationId" value="#{conversation.id}" />


              I think.

              • 4. Re: h:commandButton requires s:conversationId to work proper
                kahliburke

                Could it be that you don't have the SeamRedirectFilter in your web.xml?

                 <filter>
                 <filter-name>Seam Redirect Filter</filter-name>
                 <filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
                 </filter>
                
                 <filter-mapping>
                 <filter-name>Seam Redirect Filter</filter-name>
                 <url-pattern>*.seam</url-pattern>
                 </filter-mapping>
                


                Note that I am using *.seam as the URL pattern, yours might be different (*.jsf) depending on your configuration.

                Take a look at 13.1.3 in the docs...

                Hope it helps.

                Kahli

                • 5. Re: h:commandButton requires s:conversationId to work proper

                  I have the following:

                  <!-- Propagate conversations across redirects -->
                   <filter>
                   <filter-name>Seam Redirect Filter</filter-name>
                   <filter-class>
                   org.jboss.seam.servlet.SeamRedirectFilter
                   </filter-class>
                   </filter>
                   <filter-mapping>
                   <filter-name>Seam Redirect Filter</filter-name>
                   <servlet-name>Faces Servlet</servlet-name>
                   </filter-mapping>


                  and then:

                  <!-- Faces Servlet -->
                   <servlet>
                   <servlet-name>Faces Servlet</servlet-name>
                   <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                   <load-on-startup>1</load-on-startup>
                   </servlet>
                   <!-- Faces Servlet Mapping -->
                   <servlet-mapping>
                   <servlet-name>Faces Servlet</servlet-name>
                   <url-pattern>/faces/*</url-pattern>
                   </servlet-mapping>