[
https://issues.apache.org/jira/browse/MYFACES-3848?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Leonardo Uribe resolved MYFACES-3848.
-------------------------------------
Resolution: Fixed
Fix Version/s: 2.2.4
2.1.16
2.0.22
Assignee: Leonardo Uribe
I have finally found the problem. It was caused because the code that retrieves
the composite component metadata call DefaultFacelet.apply(...) but internally
that code does not restore the previous context, so the copy used for the
metadata is still in javax.faces.FACELET_CONTEXT attribute.
Code like f:setPropertyActionListener and other listeners relies on that param
to get the right instance. The problem was not noticed before because before
the composite component content is generated, the parameter is updated with a
new copy. In this case, the facet is created before the composite component
content is created, so the bad copy is used instead. This copy does not have
the function mapper set, because the definition is on the page and not in the
composite component.
Thanks to Gonçalo Manuel Cruchinho for provide the test case for this issue.
> FunctionMapper not found when using a function inside value of
> f:setPropertyActionListener
> ------------------------------------------------------------------------------------------
>
> Key: MYFACES-3848
> URL: https://issues.apache.org/jira/browse/MYFACES-3848
> Project: MyFaces Core
> Issue Type: Bug
> Affects Versions: 2.1.14
> Reporter: Gonçalo Manuel Cruchinho
> Assignee: Leonardo Uribe
> Fix For: 2.0.22, 2.1.16, 2.2.4
>
>
> Using f:setPropertyActionListener inside a composite component with the value
> pointing to a function generates the following exception:
> javax.el.ELException - Expression uses functions, but no FunctionMapper was
> provided.
> at com.sun.el.lang.ExpressionBuilder.visit(ExpressionBuilder.java:208)
> The following information can be used to reproduce the problem.
> myfacesTest1.xhtml
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <ui:composition
> xmlns="http://www.w3.org/1999/xhtml"
> xmlns:f="http://java.sun.com/jsf/core"
> xmlns:h="http://java.sun.com/jsf/html"
> xmlns:ui="http://java.sun.com/jsf/facelets"
> xmlns:fn="http://java.sun.com/jsp/jstl/functions"
> xmlns:t="http://java.sun.com/jsf/composite/test">
>
> <t:area>
> <f:facet name="body">
> <h:commandButton>
> <f:setPropertyActionListener
> target="#{myfacesTest1.property}" value="#{fn:substring('Hello World!', 6,
> 12)}" />
> </h:commandButton>
> </f:facet>
> </t:area>
> </ui:composition>
> MyfacesTest1.java
> import javax.faces.bean.ManagedBean;
> import javax.faces.bean.SessionScoped;
> @ManagedBean(name = "myfacesTest1")
> @SessionScoped
> public class MyfacesTest1 {
> private String property;
> public String getProperty() {
> return property;
> }
> public void setProperty(String property) {
> this.property = property;
> }
> }
> area.xhtml
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:composite="http://java.sun.com/jsf/composite">
>
> <composite:interface>
> <composite:facet name="body" required="true" />
> </composite:interface>
>
> <composite:implementation>
> <composite:renderFacet name="body" />
> </composite:implementation>
> </html>
--
This message was sent by Atlassian JIRA
(v6.2#6252)