eclipse-ee4j / mojarra

Mojarra, a Jakarta Faces implementation
Other
162 stars 110 forks source link

UIData inside UIRepeat generates same client ID for all tables #1834

Closed ren-zhijun-oracle closed 12 years ago

ren-zhijun-oracle commented 14 years ago

When UIData is nested inside UIRepeat, all generated table elements retrieve the same client ID. The isNestedWithinUIData() helper method inside getClientId() returns false for UIRepeat while it should have returned true.

XHTML example

<ui:repeat value="#

{bean.list}

" var="item">

</ui:repeat>

Actual output

Expected output ---------------
#### Environment Operating System: All Platform: All #### Affected Versions [2.0.3]
ren-zhijun-oracle commented 6 years ago
ren-zhijun-oracle commented 14 years ago

@javaserverfaces Commented Reported by @BalusC

ren-zhijun-oracle commented 13 years ago

@javaserverfaces Commented t34 said:

ren-zhijun-oracle commented 13 years ago

@javaserverfaces Commented rogerk said: triage

ren-zhijun-oracle commented 13 years ago

@javaserverfaces Commented rogerk said: triage

ren-zhijun-oracle commented 13 years ago

@javaserverfaces Commented tjstavenger said: A workaround would be to manually create the

, using to generate the rows. Though it wouldn't necessarily work too well if you are using nested . See http://java.net/jira/browse/JAVASERVERFACES-1807.

ren-zhijun-oracle commented 13 years ago

@javaserverfaces Commented apcuk said: In the table rows, the 0 is not even visible, there is simply no index.

Component id-s in different rows in the first table: repeat:table:0:... repeat:table:1:... repeat:table:2:...

Component id-s in different rows in the second table: repeat:table:0:... repeat:table:1:... repeat:table:2:...

There's no :0: between the id of the table and the ui:repeat.

Anyway, this is an annoying bug, since you cannot use ui:repeat with javascript.

ren-zhijun-oracle commented 12 years ago

@javaserverfaces Commented @BalusC said: FYI: works 100% fine on MyFaces 2.1.3.

ren-zhijun-oracle commented 12 years ago

@javaserverfaces Commented zsb said: For me the solution is to replace the function isNestedWithinUIData to the following makes the trick:

private Boolean isNestedWithinIterator() { if (isNested == null) { UIComponent parent = this; while (null != (parent = parent.getParent())) { if (parent instanceof UIData || parent instanceof UIRepeat)

{ isNested = Boolean.TRUE; break; }

} if (isNested == null)

{ isNested = Boolean.FALSE; }

return isNested; } else

{ return isNested; }

}

I renamed the function (and everywhere where it is called from) to isNestedWithinIterator and I check if the parent is instanceof UIRepeat. All actionListeners started to work well in DataTable (inside an UIRepeat).

ren-zhijun-oracle commented 12 years ago

@javaserverfaces Commented zsb said: Attaching the repaired UIData.java file based on javax.faces-2.1.4.jar. I am sorry I do not have time now to create and upload the svn patch.

Please handle this issue together with #2257 ASAP as these two makes it really hard to use any iteration component in JSF (and both has a solution since a long time)!

ren-zhijun-oracle commented 12 years ago

@javaserverfaces Commented @manfredriem said: Fixes UIData to check if it is inside a UIRepeat when creating client ids.

ren-zhijun-oracle commented 12 years ago

@javaserverfaces Commented @manfredriem said: Applied to 2.1 branch,

svn commit -m "Fixes http://java.net/jira/browse/JAVASERVERFACES-1830, r=rogerk, Fixes UIData to check if it is inside a UIRepeat when creating client ids." Sending jsf-api\src\main\java\javax\faces\component\UIData.java Adding test\agnostic\renderKit\basic\src\main\java\com\sun\faces\test\agnostic\renderKit\basic\Issue1830Bean.java Adding test\agnostic\renderKit\basic\src\main\webapp\WEB-INF\glassfish-web.xml Adding test\agnostic\renderKit\basic\src\main\webapp\issue1830.xhtml Adding test\agnostic\renderKit\basic\src\test\java\com\sun\faces\test\agnostic\renderKit\basic\Issue1830IT.java Transmitting file data ..... Committed revision 10411.

ren-zhijun-oracle commented 12 years ago

@javaserverfaces Commented @manfredriem said: Applied to 2.2 trunk,

svn commit -m "Fixes http://java.net/jira/browse/JAVASERVERFACES-1830, r=rogerk, Fixes UIData to check if it is inside a UIRepeat when creating client ids." Sending jsf-api\src\main\java\javax\faces\component\UIData.java Adding test\agnostic\renderKit\basic\src\main\java\com\sun\faces\test\agnostic\renderKit\basic\Issue1830Bean.java Adding test\agnostic\renderKit\basic\src\main\webapp\issue1830.xhtml Adding test\agnostic\renderKit\basic\src\test\java\com\sun\faces\test\agnostic\renderKit\basic\Issue1830IT.java Transmitting file data .... Committed revision 10412.

ren-zhijun-oracle commented 12 years ago

@javaserverfaces Commented File: changebundle.txt Attached By: @manfredriem

ren-zhijun-oracle commented 12 years ago

@javaserverfaces Commented File: newfiles.zip Attached By: @manfredriem

ren-zhijun-oracle commented 12 years ago

@javaserverfaces Commented File: UIData.java Attached By: zsb

ren-zhijun-oracle commented 7 years ago

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

ren-zhijun-oracle commented 12 years ago

@javaserverfaces Commented Marked as fixed on Tuesday, August 7th 2012, 2:26:00 pm