-
1. Re: ELException in jsf class name conversion in AS 7
ssilvert Jul 15, 2011 9:33 AM (in response to bcn)It's the same JSF, but a different impl version of EL. I'm not sure what the groups attribute is expecting. Does it work when you leave off the getName()?
Stan
-
2. Re: ELException in jsf class name conversion in AS 7
bcn Jul 18, 2011 8:30 AM (in response to ssilvert)No, it crashes, too:
Caused by: javax.el.ELException: /templates/searchlocation.xhtml @9,54 groups="#{bean.notEmptyCity}": Cannot convert interface com.myapp.web.constraint.group.NoConstraintGroup of type class java.lang.Class to class [Ljava.lang.Class;
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]
at org.richfaces.validator.FacesBeanValidator.getGroups(FacesBeanValidator.java:168) [richfaces-components-ui-4.0.0-20110322.220419-243.jar:]
at org.richfaces.validator.FacesBeanValidator.validate(FacesBeanValidator.java:110) [richfaces-components-ui-4.0.0-20110322.220419-243.jar:]
You are right that in fact the attribute groups should be of type Class, but AS 6 / EL is so robust that it works correctly.
Thanks
-
3. Re: ELException in jsf class name conversion in AS 7
jaikiran Jul 18, 2011 9:12 AM (in response to bcn)Looking at the stacktrace, it's expecting a Class array. So try:
public Class<?>[] getNotEmptyCity() { return new Class<?>[] {NoConstraintGroup.class}; }
I, however, have no clue why it's expecting that Class array type and why it works differently in previous AS version.
-
4. Re: ELException in jsf class name conversion in AS 7
bcn Jul 18, 2011 9:43 AM (in response to jaikiran)Thanks, that works!
It seems to be more stringent than previous versions and allows now only class arrays. For the ease of migration, I doubt that this is a good idea.
Below the relevant section of the Java EE 6 Tutorial.
--------------------------------------------
When a constraint is added to an element, the constraint declares which groups that constraint
belongs by specifying the class name of the group interface name in the groups element of the
constraint.
@NotNull(groups=Employee.class)
Phone workPhone;
Multiple groups can be declared by surrounding the groups with angle brackets ({ and }) and
separating the groups class names with commas.
@NotNull(groups={ Employee.class, Contractor.class })
Phone workPhone;