mojarra icon indicating copy to clipboard operation
mojarra copied to clipboard

UIData#invokeOnComponent shouldn't proceed if the clientId doesn't start with the UIData clientId

Open ren-zhijun-oracle opened this issue 7 years ago • 9 comments

The new Search Expressions uses findComponent or invokeOnComponent (as fallback) to get a component by id.

I have a case, where the "value" attribute of the dataTable is not yet completely resolveable and it not yet rendered.

If i use invokeOnComponent to search a component, which is placed outside of the datatable, and it hits the datatable, the dataTable will throw a exception because of the unresolvable EL. The best way to fix this would be if UIData#invokeOnComponent would check if the clientIdToSearch starts with the UIData clientId. If it doesn't match, invokeOnComponent in the UIData can be completely skipped.

It's already implemented that way in MyFaces: http://grepcode.com/file/repo1.maven.org/maven2/org.apache.myfaces.core/myfaces-api/2.1.9/javax/faces/component/UIData.java#359

This is likely also a great performance improvement for some cases.

ren-zhijun-oracle avatar Jul 13 '17 12:07 ren-zhijun-oracle

  • Issue Imported From: https://github.com/javaserverfaces/mojarra/issues/4262
  • Original Issue Raised By:@tandraschko
  • Original Issue Assigned To: Unassigned

ren-zhijun-oracle avatar Apr 18 '18 05:04 ren-zhijun-oracle

@edburns Commented Please see this important message regarding community contributions to Mojarra.

https://javaee.groups.io/g/jsf-spec/message/30

Also, please consider joining that group, as that group has taken the place of the old [email protected] mailing list.

Thanks,

Ed Burns

ren-zhijun-oracle avatar Oct 29 '17 03:10 ren-zhijun-oracle

Please fix this, it prevents us from migrating to java ee 8 because EL expressions in a datatable are executed even when the table itself is not rendered.

At least the scope of the try/finally (this.setRowIndex(savedRowIndex);) in the invokeOnComponent method should be greatly reduced to only cover the part where the index is set.

larslorenzen avatar Oct 18 '18 08:10 larslorenzen

This issue is marked as stale because there was no activity on it for the last 2 years. Remove stale label or comment or this will be closed in 30 days

github-actions[bot] avatar Aug 29 '21 01:08 github-actions[bot]

Still not fixed

tandraschko avatar Aug 29 '21 10:08 tandraschko

@tandraschko Can you supply a reproducer and/or fix?

mnriem avatar Feb 28 '22 14:02 mnriem

i dont have time to provide a PR or example but the following IF is/was missing in Mojarra: https://github.com/apache/myfaces/blob/c891d43c7740dd40c206b0638d23a11b69a0d441/api/src/main/java/jakarta/faces/component/UIData.java#L383

https://github.com/apache/myfaces/blob/c891d43c7740dd40c206b0638d23a11b69a0d441/api/src/main/java/jakarta/faces/component/UIData.java#L393

tandraschko avatar Feb 28 '22 14:02 tandraschko

it could be that it was fixed with this https://github.com/eclipse-ee4j/mojarra/pull/4506/files but i didnt verify it

tandraschko avatar Feb 28 '22 14:02 tandraschko

If i use invokeOnComponent to search a component, which is placed outside of the datatable, and it hits the datatable, the dataTable will throw a exception because of the unresolvable EL.

A reproducer is welcome. I'm having difficulty understanding the issue.

BalusC avatar Sep 09 '23 21:09 BalusC

Closing off as stale.

BalusC avatar Sep 16 '24 16:09 BalusC