1 Reply Latest reply on Oct 27, 2010 3:26 AM by nigiyan

    JSTL functions in pages.xml

    jfaath

      Is there a way to get JSTL functions to work in expressions in the pages.xml file?  For example, I'm trying to raise an event whenever the user navigates outside a section of my site using this:


          <page view-id="*" >
            <navigation>
              <rule if="#{!fn:startsWith(view.viewId, '/admin')}">
                <raise-event type="com.acme.events.MyEvent"/>
              </rule>
            </navigation>      
          </page>
      



      I end up getting this error:


      javax.el.ELException: Function 'fn:startsWith' not found
      



      Which I'm guessing means it isn't supported (yes, I declare the fn namespace).  Are there any other clever ways to make this work?


      Regards,


      JF

        • 1. Re: JSTL functions in pages.xml
          nigiyan

          try:



          if="#{seamComp.isAdminPage()}"
          
          @Name("seamComp")
          public class SeamComp {
          ...
          public boolean isAdminPage() {
            return FacesContext.getCurrentInstance().getViewRoot().getViewId().startsWith("admin");  (or "/admin" ?)
          }
          ...
          }



          or



          if="#{seamComp.getViewId() eq 'some view id name here'}"
          
          @Name("seamComp")
          public class SeamComp {
          ...
          public boolean isAdminPage() {
            return FacesContext.getCurrentInstance().getViewRoot().getViewId();
          }
          ...
          }