3 Replies Latest reply on Aug 6, 2009 2:23 PM by Julien Kronegg

    s:link and s:button action problem with ui:include

    Jarek Gilewski Newbie

      Hi,


      I have something like this in my xhtml page:


                <ui:include src="layout/remove.xhtml">
                     <ui:param name="entityHome" value="#{componentHome}" />
                </ui:include>
      



      In remove.xhtml I have:


      ...
      <s:link value="#{messages['yes']}" action="#{entityHome.remove}" />
      
      <h:form>
          <h:commandLink value="#{messages['yes']}" action="#{entityHome.remove}" /
      </h:form>
      ...
      



      The link from s:link looks like:


      http://localhost:8080/myapp/ComponentView.seam?componentId=1018&actionMethod=ComponentView.xhtml%3AentityHome.remove&cid=16
      



      and from h:commandLink


      http://localhost:8080/myapp/ComponentView.seam?componentId=1018&actionOutcome=componentHome.remove&cid=14#
      




      In the s:link there is entityHome.remove instead of componentHome.remove and the link does not work. If i change the link manually it is ok.



      h:commandLink works ok.


      It was tested on SEAM 2.1.1.GA


      Is'nt it a bug? Should I make a JIRA issue?


      Regards


      Jarek

        • 2. Re: s:link and s:button action problem with ui:include
          Daniel Bernstein Newbie

          I'm having exactly the same problem. Have you found a resolution?

          • 3. Re: s:link and s:button action problem with ui:include
            Julien Kronegg Novice

            I had the same problem with s:button. BTW, this is a Seam issue JBSEAM-666 (also occurs on Seam 2.1.2).


            I solved it by using two ui:include and without using ui:param. The structure is as follow:


            In main.xhtml:


            <ui:include src="layout/removeForComponentHome.xhtml"/>
            



            In removeForComponentHome.xhtml:


            <h:form>
            
                <ui:include src="layout/remove.xhtml"/>
            
                <div id="actionButtons">
                    <s:link value="#{messages['yes']}" action="#{componentHome.remove}" />
                    <h:commandLink value="#{messages['yes']}" action="#{componentHome.remove}" /
                </div>
            
            </h:form>
            



            In remove.xhtml:


            ... <!-- The fields without action buttons -->
            



            If I want the remove.xhtml file with action buttons referring another entity home (let's say #{anotherHome}), I'm using another intermediate include file removeForAnotherHome.xhtml:


            <h:form>
            
                <ui:include src="layout/remove.xhtml"/>
            
                <div id="actionButtons">
                    <s:link value="#{messages['yes']}" action="#{anotherHome.remove}" />
                    <h:commandLink value="#{messages['yes']}" action="#{anotherHome.remove}" /
                </div>
            
            </h:form>
            



            This is not perfect because the action button code is duplicated, but at least I could factorize remove.xhtml fields.