I’m trying to call a function from a JSF 2.0 page in my backing bean passing a dynamic parameter. It works fine as long as im passing a static string, but when I try using a dynamic one, I always get an EL parsing error. I guess its a syntax problem, but I can’t think of another way to do this using method expression. I know that I could do it with the <f:param..../> tag, but I’m not going to give up on this one 🙂
<h:dataTable var="urlresult" value="#{search.searchResults_sites_urls}">
<h:column>
<h:form>
<h:outputText value="#{urlresult}" />
<h:commandLink action="#{search.showUrls(#{urlresult})}" value=" x" />
</h:form>
</h:column>
</h:dataTable>
The method in the backing bean:
public void showUrls(String url) {
//CODE
}
How is this caused and how can I solve it?
It’s illegal to nest EL expressions
#{}. Just remove the nested expression.Also, as you’re using this in a
<h:dataTable>, in order to get it to work properly, make sure that the#{search}bean is in the view scope, or if it really needs to be request scoped, make sure that you’re preserving the#{search.searchResults_sites_urls}during bean’s initialization.See also: