1 Reply Latest reply on Dec 1, 2010 5:54 PM by Tim Evers

    Any ideas on how to add an action (pages.xml) to a page included with facelets

    Amy Nieves Newbie

      I have a page with a tab panel and several included pages using facelets include. I want an action perform when a different panel tab is selected. Right now I have an EL expression in the included page but I'd like to find a cleaner method. I usually use the action attribute in Seam's pages.xml but since the main view is always the same I haven't found any way to do it.

      Any suggestions?

        • 1. Re: Any ideas on how to add an action (pages.xml) to a page included with facelets
          Tim Evers Master

          I fail to see how a pages.xml rule will be cleaner then a simple EL expression.

          Essentially all you should have is

          <ui:include value="#{MyBean.pageToInclude}"/>

          Then in MyBean you just have action methods that get executed when certain tabs are selected.

          For example.

          public class MyBean etc etc ....
              public void tabOneClicked() {
              repeat method for all tabs.

          If you are desperate to use pages.xml then pass parameters around that determine the include page. This will work but, I don't think I would call it cleaner.

          Then again, you may want to get someone else's opinion. :) The app I'm working on we have tried very hard to not use pages.xml. Our developers can follow the flow of the application purely in the java code. Rather then having to flip back and forth to figure out what each action is going to do based on the rules in pages.xml. :)