1 Reply Latest reply on Dec 11, 2007 6:33 AM by Peter Hilton

    design discussion for adding @PageActions (@PageAction) to m

    Dan Allen Master

      One of the big benefits of Seam over plain JSF is that if you want, you can eliminate all "logic" XML and have just a sprinkling of "configuration" XML. In fact, you will see this point made by Michael Yuan in the JBoss Seam book. However, one of the coolest features of Seam, page actions, is not available without the use of XML. Currently, you must define your actions using a value-binding expression in the pages.xml file (or, alternatively, in *.page.xml files).

      I am proposing that a @PageActions (and its complement @PageAction) annotation be added to at the method level. The annotation would appear like so:

      @PageActions {
       @PageAction(view="/view1.xhtml", if="#{user.loggedIn}"),
       @PageAction(view="/view2.xhtml")
      }
      public String beforeYouRender() { ... }


      and

      @PageAction(view="/view3.xhtml")
      public String notSoFast() { ... }


      I agree that it may become difficult to track which methods are being used as page actions, if you think in terms of pages. However, by the same token, you may think in terms of classes, and then it is easy to find the associated page. It is, of course, personal taste. I just find that if we can allow the user to skip the XML coding, why not give them that option?

      Feel free to vote on this issue: http://jira.jboss.com/jira/browse/JBSEAM-1631

        • 1. Re: design discussion for adding @PageActions (@PageAction)
          Peter Hilton Newbie

          I voted for this because although I don't mind using XML, I don't like having a single file like pages.xml that grows linearly with the number of pages in my application.

          The alternative, which we currently use, are *.page.xml files, and there are several of those that only contain an action element. With these separate files, I still need to search my whole project for references to a particular view ID, which is one of the objections to the annotation style.