title: jsf Invoking Arbitrary Methods via EL
body: <p>I am starter on JSF and have trouble with invokation of arbitrary methods via EL.<br>
  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.<br>
  I am using MyFaces2.0.3, JRE6Up21, Tomcat 6.0.29 and Eclipse.<br>
  I have the following snippet in a facelet:  </p>
  
  <pre><code>&lt;h:form&gt;
  &lt;p&gt;
  &lt;h:link outcome="NextPage" value="Link for Next Page"&gt;
  &lt;f:param name="word1" value="hello" /&gt;
  &lt;f:param name="word2" value="world" /&gt;
  &lt;/h:link&gt;
  &lt;/p&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>and in the facelet NextPage.xhtml  </p>
  
  <pre><code>&lt;h:form&gt;
  &lt;p&gt;
  This is the method invocation #{model.printArgs(param.word1,param.word2)}
  &lt;/p&gt;
  &lt;/h:form&gt;  
  </code></pre>
  
  <p><code>Model</code> is a managed bean(request scoped) that has this method <code>printArgs</code> that returns a string concatenation of word1 and word2.   </p>
  
  <pre><code>@ManagedBean
  @SessionScoped
  public class Model {
  
  public String printArgs(String word1, String word2) {
          String result = "No arguments??????";
  
          if (null != word1 &amp;&amp; !word1.isEmpty() &amp;&amp; null != word2 &amp;&amp; !word2.isEmpty()) {
              result = word1+" "+word2;
          }
          return result;
  
      }
  
  }
  </code></pre>
  
  <p>When I press the link the url is <a href="http://localhost:8080/RegJSF/faces/NextPage.xhtml?word1=hello&amp;word2=world" rel="nofollow">http://localhost:8080/RegJSF/faces/NextPage.xhtml?word1=hello&amp;word2=world</a><br>
  but I get the error</p>
  
  <blockquote>
    <p>org.apache.el.parser.ParseException:
    Encountered " "(" "( "" at line 1,
    column 25. Was expecting one of: "}"
    ... "." ... "[" ... ">" ... "gt" ...
    "&lt;" ... "lt" ... ">=" ... "ge" ...
    "&lt;=" ... etc</p>
  </blockquote>
  
  <p>If i remove <code>#{model.printArgs(param.word1,param.word2)}</code> the NextPage is loaded, so the problem is the method invocation.<br>
  What is the problem here? Is it configuration issue?<br>
  <strong>Note</strong> Same issue if I use Mojarra2.0.3<br>
  Can someone help please?</p>
  
  <p>Thanks!</p>