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

Closed
xmourgues opened this issue Mar 11, 2024 · 4 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

volosied commented Apr 29, 2024

I'm sorry for the lack of response. The behavior looks intended to me. It's meant to simply be a 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.

@melloware
Copy link

@tandraschko is this something we should do in the PrimeFaces taglib.xml as well?

See: eclipse-ee4j/mojarra#5448

BalusC added a commit to eclipse-ee4j/mojarra that referenced this issue May 20, 2024
occurrences whereby setValueExpression() throws IllegalArgumentException
@melloware
Copy link

@BalusC can you explain this one more?

I opened PF ticket: primefaces/primefaces#12055

But we are wondering how does removing the type affect these var's? I see OmniFaces and Mojarra do not have a type on the var in their taglibs.

arjantijms added a commit to eclipse-ee4j/mojarra that referenced this issue Jun 23, 2024
Fix jakartaee/faces#1906: the taglib should not accept 'var' attribute as a ValueExpression
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

3 participants