Using Seam with Facelets and EL Parameters
frosted Dec 14, 2007 4:00 PMI am having an issue with using Seam with passed in Action Parameters in EL. I am tied to WebLogic right now, and hearing about the EJB3 issues that Seam has, I just want to use the UI features of Seam in order to pass parameters to method calls in the EL. I am using Seam 2.0 GA, Facelets 1.1-13, and RichFaces latest release along with the Sun RI Implementation of JSF.
In a facelets page I have the following code:
<ui:composition> <f:view> <s:fragment rendered="#{SecurityManager.isAllowed(View_Position)}">
This is throwing an exception:
com.sun.facelets.tag.TagAttributeException: //C:/dev/workspace/AppName/WebContent/WEB-INF/tabs/position.xhtml @15,68 rendered="#{SecurityManager.isAllowed(View_Position)}" Error Parsing: #{SecurityManager.isAllowed(View_Position)} at com.sun.facelets.tag.TagAttribute.getValueExpression(TagAttribute.java:259) at com.sun.facelets.tag.jsf.ComponentRule$ValueExpressionMetadata.applyMetadata(ComponentRule.java:69) at com.sun.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:36) at com.sun.facelets.tag.MetaTagHandler.setAttributes(MetaTagHandler.java:62) at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:144) at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47) at com.sun.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:109)
My web.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>DisplayName</display-name> <!-- Seam --> <listener> <listener-class>org.jboss.seam.servlet.SeamListener</listener-class> </listener> <servlet> <servlet-name>Seam Resource Servlet</servlet-name> <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Seam Resource Servlet</servlet-name> <url-pattern>/seam/resource/*</url-pattern> </servlet-mapping> <filter> <filter-name>Seam Filter</filter-name> <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class> </filter> <filter-mapping> <filter-name>Seam Filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- End Seam --> <!-- JSF --> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> <context-param> <param-name>javax.faces.DEFAULT_SUFFIX</param-name> <param-value>.xhtml</param-value> </context-param> <context-param> <param-name>facelets.VIEW_MAPPINGS</param-name> <param-value>*.jspx;*.xhtml;</param-value> </context-param> <context-param> <param-name>facelets.DEVELOPMENT</param-name> <param-value>true</param-value> </context-param> <context-param> <param-name>facelets.REFRESH_PERIOD</param-name> <param-value>2</param-value> </context-param> <context-param> <param-name>facelets.LIBRARIES</param-name> <param-value> /WEB-INF/htmLib.taglib.xml; /WEB-INF/facelets/tags/dems.taglib.xml; </param-value> </context-param> <!-- RichFaces Configuration --> <context-param> <param-name>org.richfaces.SKIN</param-name> <param-value>blueSky</param-value> </context-param> <filter> <display-name>Ajax4jsf Filter</display-name> <filter-name>ajax4jsf</filter-name> <filter-class>org.ajax4jsf.Filter</filter-class> </filter> <filter-mapping> <filter-name>ajax4jsf</filter-name> <servlet-name>Faces Servlet</servlet-name> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> </filter-mapping> <!-- End RichFaces Configuration -->
My faces-config.xml:
<?xml version="1.0" encoding="UTF-8"?> <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd" version="1.2"> <application> <el-resolver>org.jboss.seam.el.SeamELResolver</el-resolver> <locale-config> <default-locale>en</default-locale> </locale-config> <view-handler>com.sun.facelets.FaceletViewHandler</view-handler> </application> </lifecycle> <factory> <application-factory>com.sun.faces.application.ApplicationFactoryImpl</application-factory> <faces-context-factory>com.sun.faces.context.FacesContextFactoryImpl</faces-context-factory> <lifecycle-factory>com.sun.faces.lifecycle.LifecycleFactoryImpl</lifecycle-factory> <render-kit-factory>com.sun.faces.renderkit.RenderKitFactoryImpl</render-kit-factory> </factory>
It seems that the FaceletViewHandler is still being used to interpret EL expressions. I find documentation relating to Seam 1.1 that refer to a SeamFaceletViewHandler, but that seems to be missing from Seam 2.0. Is there something glaringly obvious I am missing? Please let me know if you need further information regarding my configuration or anything else.
Thanks!