1 Reply Latest reply on Jun 21, 2006 7:17 PM by Gavin King

    Would anyone be opposed if I recommend the following to the

    Daniel Hinojosa Master

      Cutting to the chase....I would like this a part of the JSF EL....

      <h:commandLink action="#{myBean.process(3, 2, #{anotherBean.name})}" />

      You may have to look at that one sideways but in what I have here is an action call to a method called process that is on an object mapped as myBean. Process is accepting 3 parameters: an int, int, and a String. You can have whatever parameters you would like....

      Some advantages:
      1. No need to write a JSF or a Seam friendly bean, just use an existing service bean. You are able to use more classes and objects without re-engineering.
      2. You can use method overloading. No more needed to think of a mutitude of names for one desired behavior.
      3. You can do possible calculations on the fly even with static classes! For example

      <h:outputText value="#{myBean.a}"/>
      <h:outputText value="#{myBean.b}"/>
      <h:outputText value="#{Math.max(#{myBean.a}, #{myBean.b})}" />

      One disadvantage
      1. Navigation case can be a pain the ass
      <navigation-rule>
      <navigation-case>
      <from-action>#{myBean.process(int, int)}</from-action>
      <from-outcome>Success</from-outcome>
      <to-view-id>/index.jsp</to-view-id>

      </navigation-case>
      <navigation-case>
      <from-action>#{myBean.process(int, int, float)}</from-action>
      <from-outcome>Success</from-outcome>
      <to-view-id>/index.jsp</to-view-id>

      </navigation-case>
      <navigation-case>
      <from-action>#{myBean.process(int, int, float, double)}</from-action>
      <from-outcome>Success</from-outcome>
      <to-view-id>/index.jsp</to-view-id>

      </navigation-case>
      </navigation-rule>

      Let me know what you think

        • 1. Re: Would anyone be opposed if I recommend the following to
          Gavin King Master

          We totally agree with you, and we (actually Stan Silvert) currently have an experimental JSF fork where we have been playing with this and other ideas with a view to contributing back to the RI and spec. I'm not sure if Stan finished implementing this yet, but the syntax we proposed was:

          <h:commandLink action="#{myBean.process(3, 2, anotherBean.name)}" />


          for method bindings.

          Another thing we have in our fork is support for navigation rules like:

          <navigation-case>
           <from-action>#{searchAction.search}</from-action>
           <to-view-id>/index.jsp</to-view-id>
           <redirect>
           <redirect-param-name>searchPattern</redirect-param-name>
           <redirect-param-value>#{searchAction.searchPattern}</redirect-param-value>
           </redirect>
          </navigation-case>


          Unfortunately, it is not possible do support either of these things without changes to JSF.

          Now, it is possible that we (JBoss) might decide to provide production-usable builds of our JSF fork, but the trouble with that is it would be seen to be in competition with the RI and MYFaces, which is somewhere we don't really want to be.