Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UISelectItems ValueExpression in var attribute throws IllegalArgumentException #1906

Open
xmourgues opened this issue Mar 11, 2024 · 2 comments

Comments

@xmourgues
Copy link

Hello,

Since this commit (eclipse-ee4j/mojarra@33c3d06) we can no longer set a ValueExpression inside the var attributes of f:selectItems.

This is breaking one of our composite component.
The vdl doc (https://jakarta.ee/specifications/faces/4.0/vdldoc/f/selectitems#var) still says that var can take a ValueExpression which should evaluate to a String.

Here is a minimal example :

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="jakarta.faces.html" xmlns:f="jakarta.faces.core" xmlns:ui="jakarta.faces.facelets"
	xmlns:composite="jakarta.faces.composite">
<composite:interface componentType="compositeSelectOne">
	<composite:attribute name="compositeVar" />
	<composite:attribute name="compositeItemLabel" />
	<composite:attribute name="compositeItemValue" />
</composite:interface>
<composite:implementation>
	<h:selectOneListbox id="firstList" value="...">		
		<f:selectItems value="..." var="#{cc.attrs.compositeVar}" itemValue="#{cc.attrs.compositeItemLabel}" itemLabel="#{cc.attrs.compositeItemValue}" />
	</h:selectOneListbox>	
</composite:implementation>
</html>

Is this a bug or is it really the new intended behavior ? If it is intended, how would one work around this ?

@xmourgues
Copy link
Author

Hello again,
As a workaround we removed the use of the EL inside the var attribute and forced it to a specific value that we had to impact on every usage of this composite component.
It's less sexy, but it works.

So at the very least, the vdl doc should be fixed.
Any comment on this ?

@volosied
Copy link
Contributor

I'm sorry for the lack of response. The behavior looks intended to me since it's mean to simply be name which can be referred to within other value expressions (i.e. the itemValue attribute). We should fix up the vld doc at the least.

@BalusC may offer more insight since he originally implemented this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants