2 Replies Latest reply on Aug 26, 2009 3:14 PM by Tomasz Wilczynski

    s:link component and JSF-like outcomes

    Piotr Sobczyk Newbie

      In JSF command components it's possible to pass an outcome that is than matched by navigation rules right into action parameter of copmponent (insead of method binding expressions), for example:

      <h:commandButton value="Save" action="success"/>

      I tried to do similar with


      component wchich is also used to pass page parameters:

      <s:link value="Save" action="success">
      <f:param name="clientId" value="_client.id"/>

      Navigation seems to perform just as in JSF but the page parameter is dropped (is not delivered to the target page). I read in Seam documentation only about binding action method to the action attribute of s:link tag - then everything works fine. But it's hard to believe for me that in such elegant framework as Seam only that I can do when I need a layer of abstraction (that I have by taking advantage navigation rules instead of defining target view id directly in view attribute) is to create stub action methods that only return outcome.

      Anyone can tell my what is the reason of s:link parameters being dropped when I give outcome to action attibute and is there any way to get it around without defining pointless action methods returning that outcome (and complicating application by the way)?

        • 1. Re: s:link component and JSF-like outcomes
          Piotr Sobczyk Newbie

          Ok, I was wrong, passing method binding expression to action parameter of s:link doesn't change anything. Outcome of invoked action method is matched in navigation rules and proper navigation occurs but page parameters are still being dropped. Sure I can use h:commandLink instead and then page parameters work just fine, but then I loose ability to open link in new tab or create bookmarks :(.

          So my final question is: is there a way to transmit page parameters from s:link tag using it's action attribute rather than view?

          • 2. Re: s:link component and JSF-like outcomes
            Tomasz Wilczynski Newbie

            The GET parameter you attach to s:link by f:param nedds to be declared as a page param to be honored when using jsf navigation rules. Consider the following link:

            <s:link action="goSomewhere" value="Link">
              <f:param name="foo" value="bar" />

            To get it work you need the following in pages.xml:

            <page view-id="/pageOne.xhtml" >   
              <param name="foo"/>
              <navigation from-action="goSomewhere">
                  <redirect view-id="/pageTwo.xhtml" />