Passing a Enum value as a parameter from JSF
This question already deals with this issue, however the proposed solution has not worked for me. I define the following enumeration in my backing bean:
public enum QueryScope {
SUBMITTED("Submitted by me"), ASSIGNED("Assigned to me"), ALL("All items");
private final String description;
public String getDescription() {
return description;
}
QueryScope(String description) {
this.description = description;
}
}
Then I use it as a method parameter
public void test(QueryScope scope) {
// do something
}
And use it via EL in my JSF page
<h:commandButton
id = "commandButton_test"
value = "Testing enumerations"
action = "#{backingBean.test('SUBMITTED')}" />
So far so good - identical to the problem posed in the original question. However I have to deal with a javax.servlet.ServletException: Method not found: %fully_qualified_package_name%.BackingBean.test(java.lang.String)
.
So it seems that JSF is interpreting the method call as if I would like to call a method with String as parameter type (which of course does not exist) - therefore no implicit conversion takes place.
What could be the factor that makes the behavior differ in this example from the aforelinked?