I'm trying to reference constant with EL on my JSF page (https://java.net/projects/el-spec/pages/StaticField), but I'm stuck on this exception:
javax.servlet.ServletException: /faces/signup.xhtml @18,85 maxlength="#{signUpBean.USERNAME_MAXLENGTH}": Property 'USERNAME_MAXLENGTH' not found on type com.foo.SignUpBean
I'm using Tomcat 8.0.0-RC1 and here is my backing bean and input declaration:
Bean:
@ManagedBean
@RequestScoped
public class SignUpBean implements Serializable {
public static final int USERNAME_MAXLENGTH = 30;
...
}
Input field on my page:
<input type="text" jsf:id="username" jsf:value="#{signUpBean.username}" maxlength="#{signUpBean.USERNAME_MAXLENGTH}" />
Update:
With maxlength="#{(com.foo.SignUpBean).USERNAME_MAXLENGTH}"
I'm getting java.lang.NullPointerException: Argument Error: Parameter value is null