1

.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>
4

1 に答える 1