我在.xhtml
文件中包含此代码:
<h:inputText id="userName" value="#{userEntity.userName}"
title="${bundle['signup.createuser.username']}"
maxlength="#{jsfConst.userNameMaxFieldSize}">
</h:inputText>
但是在Embedded Glassfish 4.0中部署maxlength
文件时,永远不会设置war
属性。我将相同的war
文件部署到Glassfish 4.0安装,它工作正常。
我在我的POM中使用了这个Glassfish依赖项:
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>4.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-glassfish-embedded-3.1</artifactId>
<version>1.0.0.CR3</version>
<scope>test</scope>
</dependency>
这是jsfConst.java
文件:
@ManagedBean
@Singleton
@ConcurrencyManagement(ConcurrencyManagementType.BEAN)
public class JsfConst {
public int getEmailFieldSize() {
return Const.emailFieldSize;
}
public int getUserNameMaxFieldSize() {
return Const.userNameMaxFieldSize;
}
}
我的问题是,我在Embedded Glassfish中缺少什么使它无法启用EL?
更新
这是web.xml
文件:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<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>*.xhtml</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<error-page>
<exception-type>com.sun.faces.context.FacesFileNotFoundException</exception-type>
<location>/pagenotfound.jsp</location>
</error-page>
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/sessionexpired.jsp</location>
</error-page>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
</web-app>
答案 0 :(得分:0)
在Arquillian中,您需要声明构成WAR文件的所有类以进行部署和测试。只需使用JsfConst
ShrinkWrap.create(WebArchive.class, "createUser.war").addClass(JsfConst.class)
即可