myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Commented] (MYFACES-3964) c:foreach not working when using custom equals or non serializable objects
Date Tue, 31 Mar 2015 20:35:54 GMT

    [ https://issues.apache.org/jira/browse/MYFACES-3964?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14389353#comment-14389353
] 

Leonardo Uribe commented on MYFACES-3964:
-----------------------------------------

I have checked the problem and I notice something curious. If you set this param:

 <context-param>
    <param-name>org.apache.myfaces.CACHE_EL_EXPRESSIONS</param-name>
    <param-value>alwaysRecompile</param-value>
 </context-param>

The example provided works. 

Since 1.1.x c:forEach uses variable mapper to store the value of the iterated EL expression.


The reason why enable that param works is because the fix in place for alwaysRecompile uses
an "indirection" hack to store the value not in the EL expressions using the variable mapper
(in that case the value is stored when the EL is created, that's why it doesn't change), but
store that into FaceletState "binding" map. Then, the algorithm inside c:forEach is already
able to refresh the values and if the values are refreshed, the example will work.

The solution is make the indirection hack the default and only mode used by c:forEach in any
situation. It has a lot more sense to decouple any state from the EL generation. This is a
risky change, it requires some additional testing to see if it works well.

> c:foreach not working when using custom equals or non serializable objects
> --------------------------------------------------------------------------
>
>                 Key: MYFACES-3964
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3964
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 2.2.7
>            Reporter: Gonçalo Manuel Cruchinho
>         Attachments: MyFaces22Test.war
>
>
> c:foreach doesn't work as intended when using an object with an overriden equals. The
same problem is observed when using an non serializable object. In both cases the problem
seems to be that the foreach component caches and uses an outdated reference to the object.
> When using a serializable object with a non overwriten equals method, all works as intended.
> When forcing org.apache.myfaces.STRICT_JSF_2_FACELETS_COMPATIBILITY as true on the web.xml
file, all works as intended.
> When using ui:repeat, all works as intended.
> I created a test case that demonstrates the problem.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message