I am starter on JSF and have trouble with invokation of arbitrary methods via EL.
According to what I read version 2.1 of the Unified Expression Language, included in Java EE 6, has support for invoking arbitrary methods and passing arguments to them.
I am using MyFaces2.0.3, JRE6Up21, Tomcat 6.0.29 and Eclipse.
I have the following snippet in a facelet:
<h:form>
<p>
<h:link outcome="NextPage" value="Link for Next Page">
<f:param name="word1" value="hello" />
<f:param name="word2" value="world" />
</h:link>
</p>
</h:form>
and in the facelet NextPage.xhtml
<h:form>
<p>
This is the method invocation #{model.printArgs(param.word1,param.word2)}
</p>
</h:form>
Model
is a managed bean(request scoped) that has this method printArgs
that returns a string concatenation of word1 and word2.
@ManagedBean
@SessionScoped
public class Model {
public String printArgs(String word1, String word2) {
String result = "No arguments??????";
if (null != word1 && !word1.isEmpty() && null != word2 && !word2.isEmpty()) {
result = word1+" "+word2;
}
return result;
}
}
When I press the link the url is http://localhost:8080/RegJSF/faces/NextPage.xhtml?word1=hello&word2=world
but I get the error
org.apache.el.parser.ParseException: Encountered " "(" "( "" at line 1, column 25. Was expecting one of: "}" ... "." ... "[" ... ">" ... "gt" ... "<" ... "lt" ... ">=" ... "ge" ... "<=" ... etc
If i remove #{model.printArgs(param.word1,param.word2)}
the NextPage is loaded, so the problem is the method invocation.
What is the problem here? Is it configuration issue?
Note Same issue if I use Mojarra2.0.3
Can someone help please?
Thanks!