You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org> on 2010/02/12 17:47:28 UTC

[jira] Created: (MYFACES-2553) Handle MethodExpressions on correctly

Handle MethodExpressions on <composite:attribute> correctly
-----------------------------------------------------------

                 Key: MYFACES-2553
                 URL: https://issues.apache.org/jira/browse/MYFACES-2553
             Project: MyFaces Core
          Issue Type: Bug
          Components: JSR-314
    Affects Versions: 2.0.0-beta-2
            Reporter: Jakob Korherr
            Assignee: Jakob Korherr


There are currently problems when <composite:attribute> refers to a MethodExpression.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2553) Handle MethodExpressions on correctly

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2553?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12833370#action_12833370 ] 

Jakob Korherr commented on MYFACES-2553:
----------------------------------------

A really good solution, Leonardo :)

> Handle MethodExpressions on <composite:attribute> correctly
> -----------------------------------------------------------
>
>                 Key: MYFACES-2553
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2553
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-2
>            Reporter: Jakob Korherr
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.0-beta-2
>
>
> There are currently problems when <composite:attribute> refers to a MethodExpression.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2553) Handle MethodExpressions on correctly

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2553?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12833252#action_12833252 ] 

Leonardo Uribe commented on MYFACES-2553:
-----------------------------------------

It seems there is a misunderstanding about the javadoc. It says:

"....Otherwise, assume that the MethodExpression  should be placed in the components attribute set. The runtme must create the MethodExpression instance based on the value of the "method-signature" attribute....."

It has sense the related component attribute set is the one from the composite, not the one pointed by targets property, because this property is only valid for the previous four attributes.

Unfortunately, this does not solve the problem. Doing some tests, the code try to find a method called move1to2, with base object as cc.attrs map. We can't do anything from CompositeComponentELResolver because we don't have the property that should be retrieved from the map, and the method is invoked internally.

It is clear we have to do something from before the original MethodExpression created by the current ExpressionFactory invoked. Debugging the code from where the event is invoked (UICommand.broadcast) the closest point is org.apache.myfaces.view.facelets.el.TagMethodExpression. This class is created from TagAttributeImpl.getMethodExpression() and wraps the original MethodExpression. This is not going to be an easy workaround ......

Suggestions are welcome.

> Handle MethodExpressions on <composite:attribute> correctly
> -----------------------------------------------------------
>
>                 Key: MYFACES-2553
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2553
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-2
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>
> There are currently problems when <composite:attribute> refers to a MethodExpression.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2553) Handle MethodExpressions on correctly

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2553?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12833253#action_12833253 ] 

Leonardo Uribe commented on MYFACES-2553:
-----------------------------------------

It seems there is a misunderstanding about the javadoc. It says:

"....Otherwise, assume that the MethodExpression  should be placed in the components attribute set. The runtme must create the MethodExpression instance based on the value of the "method-signature" attribute....."

It has sense the related component attribute set is the one from the composite, not the one pointed by targets property, because this property is only valid for the previous four attributes.

Unfortunately, this does not solve the problem. Doing some tests, the code try to find a method called move1to2, with base object as cc.attrs map. We can't do anything from CompositeComponentELResolver because we don't have the property that should be retrieved from the map, and the method is invoked internally.

It is clear we have to do something from before the original MethodExpression created by the current ExpressionFactory invoked. Debugging the code from where the event is invoked (UICommand.broadcast) the closest point is org.apache.myfaces.view.facelets.el.TagMethodExpression. This class is created from TagAttributeImpl.getMethodExpression() and wraps the original MethodExpression. This is not going to be an easy workaround ......

Suggestions are welcome.

> Handle MethodExpressions on <composite:attribute> correctly
> -----------------------------------------------------------
>
>                 Key: MYFACES-2553
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2553
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-2
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>
> There are currently problems when <composite:attribute> refers to a MethodExpression.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (MYFACES-2553) Handle MethodExpressions on correctly

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-2553?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leonardo Uribe resolved MYFACES-2553.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0-beta-2
         Assignee: Leonardo Uribe  (was: Jakob Korherr)

I committed a fast and simple solution. The idea is detect when we have this "indirection" case and if so, create a wrapper that deal with this case, getting the value from the map and then invoking the required MethodExpression.

> Handle MethodExpressions on <composite:attribute> correctly
> -----------------------------------------------------------
>
>                 Key: MYFACES-2553
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2553
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-2
>            Reporter: Jakob Korherr
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.0-beta-2
>
>
> There are currently problems when <composite:attribute> refers to a MethodExpression.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-2553) Handle MethodExpressions on correctly

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2553?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12833178#action_12833178 ] 

Leonardo Uribe commented on MYFACES-2553:
-----------------------------------------

Testing mojarra example ajax-component/switchlistComponent.jsf

The use of the composite component is this:

              <ez:switchlist id="switchlist" selected1="#{switchlist.list1}" selected2="#{switchlist.list2}"
                      items1="#{switchlist.items1}" items2="#{switchlist.items2}"
                      move1to2="#{switchlist.move1to2}" move2to1="#{switchlist.move2to1}"/>

The composite component has something like this in its declaration:

<cc:attribute name="move1to2" targets="move1to2" required="true" method-signature="void f1(javax.faces.event.ActionEvent)" />

inside <cc:implementation> it has something like this:

<h:commandButton id="move1to2" value="&gt;&gt;" actionListener="#{cc.attrs.move1to2}" styleClass="switchlistButton"/>

When the page is rendered, the following message is shown below:

com.sun.faces.application.view.FaceletViewHandlingStrategy retargetMethodExpressions
WARNING: JSF1092: Composite Component: switchlist.xhtml, library: switchlist : Unnecessary specification of the 'targets' attribute for composite attribute 'move2to1'.  The 'targets' attribute is only necessary when the composite attribute is named 'action', 'actionListener', 'validator', or 'valueChangeListener'.

Checking myfaces, the attribute is retarget to h:commandButton, but on attribute "move1to2". 

To make this work, the attribute must not be retarget, but it is not very clear what should happen instead. It seems according to the warning there is some missing undocumented detail on ViewDeclarationLanguage.retargetMethodExpressions that do "something".

Suggestions are welcome.

> Handle MethodExpressions on <composite:attribute> correctly
> -----------------------------------------------------------
>
>                 Key: MYFACES-2553
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2553
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-2
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>
> There are currently problems when <composite:attribute> refers to a MethodExpression.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.