eclipse-ee4j / mojarra

Mojarra, a Jakarta Faces implementation
Other
161 stars 109 forks source link

TransientView does not adequately support composite components with composite:insertChildren #3465

Closed ren-zhijun-oracle closed 9 years ago

ren-zhijun-oracle commented 10 years ago

JSF 2.1 supports ui:composite components, as means of conviniently making new Ui Components without having to write custom component-types and rendered-types.

Additionally, there is also the nice feature of tansient="true" views, for light-weight server state.

It seems that the features do not dance well together.

At least in Mojarra 2.1.15 the following bug/issue seems to take place due to the moment in time where the insert children is actually added to the parent as opossed to the "parentComposite" component.

Write a composite component such as:

Finally, use your composite component in an .xhtml view such as: So, this is my:onOffButton is place in a non transient view, the button works correctly no issues. If you place this in a transient view, then, what seems to happen is the following: (a) During the restore view phase you have the CompositeComponentHandler creating the prime faces select one button. (b) Then, the tree creation process is delegated to child component of the prime faces select one InsertChildrenHandler.apply(FaceletContext, UIComponent) line: 105 ComponentHandler(DelegatingMetaTagHandler).applyNextHandler(FaceletContext, UIComponent) line: 137 ComponentTagHandlerDelegateImpl.apply(FaceletContext, UIComponent) line: 187 – the prime faces select one button being created by ComponentHandler is delegating the task of creating the children nodes onto the InserChildren Handler ComponentHandler(DelegatingMetaTagHandler).apply(FaceletContext, UIComponent) line: 120 (c) The inser children handler under the select one button runs the following code: public void apply(FaceletContext ctx, UIComponent parent) throws IOException { UIComponent compositeParent = UIComponent.getCurrentCompositeComponent(ctx.getFacesContext()); if (compositeParent != null) { int count = parent.getChildCount(); compositeParent.subscribeToEvent(PostAddToViewEvent.class, new RelocateChildrenListener(ctx, parent, count, this.tag.getLocation())); } } We can see that at this point the two "selectItems" are nested under the
ren-zhijun-oracle commented 6 years ago
ren-zhijun-oracle commented 10 years ago

@javaserverfaces Commented Reported by sono99

ren-zhijun-oracle commented 10 years ago

@javaserverfaces Commented @manfredriem said: Can you please send a reproducer (with sources) to issues@javaserverfaces.java.net? Thanks!

ren-zhijun-oracle commented 10 years ago

@javaserverfaces Commented sono99 said: Hi, So here is a link to a 7zip file. https://drive.google.com/file/d/0B_dEiNBGUsxqcVZQWDVFT1NaVFU/edit?usp=sharing

Within it is contained a small mvn project that comprises two xhtml pages.

E.g. http://localhost:8080/jsf-transient-3461/index.xhtml http://localhost:8080/jsf-transient-3461/index-transient.xhtml

The difference btween the two is that one is transient the other is not. One works the other does not.

Just mvn clean install and deploy the war to, for example, glassfish 3.1.2.5.

My kindest regards, Nuno.

ren-zhijun-oracle commented 10 years ago

@javaserverfaces Commented @manfredriem said: Can you please send it to issues@javaserverfaces.java.net? Thanks!

ren-zhijun-oracle commented 10 years ago

@javaserverfaces Commented sono99 said: Done.

Thanks.

ren-zhijun-oracle commented 9 years ago

@javaserverfaces Commented sono99 said: Hi, are there any news on this one?

Thanks.

ren-zhijun-oracle commented 9 years ago

@javaserverfaces Commented @manfredriem said: Can you please try it on the latest 2.2 version? Thanks!

ren-zhijun-oracle commented 9 years ago

@javaserverfaces Commented @manfredriem said: Lowering priority because of no response

ren-zhijun-oracle commented 9 years ago

@javaserverfaces Commented sono99 said: Hi Manfred,

I disagree with the decision.

I have not had an opportunity to review the bug in the head revision of JSF as you have requested.

However, I belive that sample I-ve given you bein made in maven, and you guys being experts in JSF, should be able to verify the issue in the latest revision in seconds.

Please do not sweep the issue under the rug, I have go through the trouble of building you a sample project and give you the description of the origin of the bug being in you magic swaping of the children of a composite node into the actual parent node.

You should take the bug report seriously and dedicate some time to verify it.

We have simply not refactore the page affected by the bug to be transient, because we have other priorities to take care of.

Many thanks, Nuno.

ren-zhijun-oracle commented 9 years ago

@javaserverfaces Commented sono99 said: In addition,

If wou were to check if the bug is present in release 2.2, and you were to verify that bug is also present there, than it would be incorrect to say that this a minor bug. This quite a significant bug for any project trying to build statless JSF views and working with custom components.

Many thanks.

ren-zhijun-oracle commented 9 years ago

@javaserverfaces Commented sono99 said: Finally,

I can confirm the bug is present in the JSF 2.2 latest release.

Please use the project that I have submitted to you by e-mail, swap the pom.xml on that project by the following.

You can use tomcat version that comes bundled with the latest release of netbeans or any container you wish, it ultimately does not matter.

As I explained in the previous post visit the pages:

http://localhost:8084/transient/index-transient.xhtml http://localhost:8084/transient/index.xhtml

Click the submit button, and verify that only the non transient page is working.

The bug is not minor, and the test i have just done would have taken the experts here half a second.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

4.0.0 jsf transient war 1.0-SNAPSHOT jsf Maven Webapp [http://maven.apache.org](http://maven.apache.org) junit junit 3.8.1 test org.primefaces primefaces 5.1 javax.servlet jstl 1.2 provided javax.servlet javax.servlet-api 3.0.1 provided com.sun.faces jsf-api 2.2.8-02 com.sun.faces jsf-impl 2.2.8-02 javax.el el-api 2.2 provided com.sun.el el-ri 1.0 provided jsf-transient-3461 org.apache.maven.plugins maven-eclipse-plugin 2.0 true true org.eclipse.wst.common.project.facet.core.nature org.jboss.tools.jst.web.kb.kbnature org.eclipse.wst.common.project.facet.core.builder org.jboss.tools.jst.web.kb.kbbuilder 3.0 2.0 1.0 .settings/org.eclipse.wst.common.project.facet.core.xml ]]>
ren-zhijun-oracle commented 9 years ago

@javaserverfaces Commented @manfredriem said: See associated duplicate issue for fix

ren-zhijun-oracle commented 9 years ago

@javaserverfaces Commented sono99 said: Hi Manfred,

Thank you for the update.

The issue to which you are referring me to as a duplicated was created today even. Why exactly did you label this one as duplicate of the other? Should it not be the other way around.

I see from you/re latest post that it is fixed in 2.1.30.

The 2.130 is not yet released I would assume.

Many thanks, Nuno.

ren-zhijun-oracle commented 9 years ago

@javaserverfaces Commented @manfredriem said: As this was a back port of a previously filed issue this issue is indeed a duplicate of it.

Correct, 2.1.30 has not been released yet.

ren-zhijun-oracle commented 9 years ago

@javaserverfaces Commented sono99 said: Thanks Manfred.

ren-zhijun-oracle commented 10 years ago

@javaserverfaces Commented Issue-Links: duplicates JAVASERVERFACES-3563

ren-zhijun-oracle commented 7 years ago

@javaserverfaces Commented This issue was imported from java.net JIRA JAVASERVERFACES-3461

ren-zhijun-oracle commented 9 years ago

@javaserverfaces Commented Marked as fixed on Tuesday, December 9th 2014, 8:32:11 am