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

Leonardo Uribe commented on MYFACES-2594:
-----------------------------------------

After checking this one, the conclusion was this issue should be closed as 
won't fix.

Both RI and Myfaces are doing what is expected, or in other words, are doing 
everything from the view point of the EG.

The effect demostrated by the example is a side effect of apply the facelet 
after before render response. When we have this cases:

- javax.faces.PARTIAL_STATE_SAVING= false
- javax.faces.PARTIAL_STATE_SAVING=true and 
org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS=true
- javax.faces.PARTIAL_STATE_SAVING=true and 
org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS=auto and there is a c:if, 
c:choose, c:forEach, ui:insert with src=valueexpression on the same facelet.

The bad behavior is presented. The reason is in this configurations the current 
view is "refreshed" or "updated" by facelets algorithm, to allow components to 
be added/removed on the tree triggered by a value change on invoke application 
phase (c:if, c:forEach, c:when ......). In fact, that algorithm "detach" and 
"attach" all components from the tree, so in that case, is facelets code that 
detach and "resort" the nodes as originally was on the xml markup. The reason 
why myfaces works with PSS enabled is that this specific code does not happen 
in this case, but the drawback is we can't use in this case c:if to trigger 
tree changes when a value changes on invoke application phase.

In theory, users should not change the components created by facelets or bound 
by a facelet tag handler. But you can create components programatically and 
add/remove to the tree, so if you create UIColumn instances inside the 
h:datatable and try this example, it will work.

I don't think fix facelets algorithm could be possible. Since we cannot advance 
more on this issue I'll close it as won't fix.

> Facelets state saving doesn't handle well programmatic component manipulation
> -----------------------------------------------------------------------------
>
>                 Key: MYFACES-2594
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2594
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 2.0.0-beta-3
>         Environment: myfaces trunk
>            Reporter: Martin Koci
>            Priority: Minor
>
> Simple tests (code pasted below) outputs following results: 
> 1) JSP: switchs colums at every click with no problem
> 2) Facelets with javax.faces.PARTIAL_STATE_SAVING=false - no visual switch
> 3) Facelets with javax.faces.PARTIAL_STATE_SAVING=true switchs colums at 
> every click with no problem
> Common code from test.jspx and test.xhtml
> ... jsp: or facelets stuff  here ...
>     <h:form id="form">
>        <h:commandButton value="Switch columns">
>         <f:actionListener binding="#{testBean}" />
>       </h:commandButton>
>       <h:dataTable id="table">
>         <h:column>
>           <f:facet name="header">
>             <h:outputText value="firstName" />
>           </f:facet>
>         </h:column>
>         <h:column>
>           <f:facet name="header">
>             <h:outputText value="surname" />
>           </f:facet>
>         </h:column>
>       </h:dataTable>
>      </h:form>
> @ManagedBean
> @RequestScoped
> public class TestBean implements ActionListener {
>         public void processAction(ActionEvent event) throws 
> AbortProcessingException {
>                 FacesContext context  = FacesContext.getCurrentInstance();
>                 UIComponent table = 
> context.getViewRoot().findComponent("form:table");
>                 UIComponent column1 = table.getChildren().get(0);
>                 UIComponent column2 = table.getChildren().get(1);
>                 table.getChildren().clear();
>                 table.getChildren().add(column2);
>                 table.getChildren().add(column1);
>         }
> }

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

Reply via email to