-
Notifications
You must be signed in to change notification settings - Fork 112
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
Component default required attribute is evaluated differently with xhtml/java implementation #5417
Comments
@chaloma1 does the same happen with MyFaces 4? |
@melloware tried with myFaces: FirstComponent which has required default value in xhtml works ok. |
Just to be clear its a bug in MyFaces too? |
Default set in xhtml (component interface) is fixed in MyFaces -> so this seems like a bug in Mojarra only |
OK can you open a MyFaces ticket too please: https://issues.apache.org/jira/projects/MYFACES/issues/MYFACES-4655?filter=allopenissues |
Sure, just need few days until new Jira account is created. |
Issue at MyFaces created https://issues.apache.org/jira/browse/MYFACES-4656. |
Again the EL literal vs VE matter. Work around for now, use |
literal instead of VE, this will fail when the final value itself is VE
By the way, this
The attributes/properties can't be set before construction. It goes like this:
and thus not like this ;)
|
Tried multiple things because i was not sure how the default parameter was applied at that time. But yes, you are correct, thanks. |
Works, thanks. The ThirdComponent with overriden isRequired method is still a mystery though. |
Third component problem with overriden isRequired method was solved in MyFaces ticket. Fault was on my side, when i was looking at the stateHelper eval function i did not notice that "required" isnt the same as PropertyKeys.required enum. The eval function looks for key.toString() only for the value expressions. So literal value was not found. If anyone uses
then setRequired is needed as well
|
The override is unnecessary unless you want to perform additional action but then you should be doing something like:
If you aren't doing that, just remove the method. Its default behavior is fine. |
#5417: remove "optimization" when composite attribute default is literal instead of VE, this will fail when the final value itself is VE
+ eclipse-ee4j#5417: remove "optimization" when composite attribute default is literal instead of VE, this will fail when the final value itself is VE Signed-off-by: pizzi80 <paolo@given2.com>
attribute default value wasn't anymore available when explicitly calling getAttributes().get(name) rather than relying on statehelper -- this has been fixed
This fix has broken default value implementation in composite component. InstanceFactory.pushDeclaredDefaultValuesToAttributesMap no longer adds attributes to attrs, so default attributes which is not supplied in call to composite component is not available in attrs. |
@pktripathy please open a new issue then with your details. |
Mentioned regression has been fixed as per #5460 |
Describe the bug
Component with required attribute and default parameter specified in xhtml interface definition ignores calling java methods in xhtml like #{true} or #{xxxController.isComponentRequired}. If the required attribute is set as plain string "true", then it works.
Component with not defined default value in xhtml works with both #{true}, #{xxxController.isComponentRequired} or plain string "true"
Component with overriden isRequired() method using "required" instead PropertyKeys.required string as in UIInput parent class (you can add default value here if attribute is not found or set). Works with #{true} or #{xxxController.isComponentRequired} but not with plain string like "true".
To Reproduce
primefaces-test-git.zip
See the attached sample. You can execute the sample with mvn jetty:run command and hit http://localhost:8080/primefaces-test to run the page.
Expected behavior
Implementation type should not matter (at least the required attribute within xhtml component interface) and all of those values should have the same required result.
In the sample project i also tried using non-component specific attribute for FirstComponent like "styleClass" which is working ok even with default value.
Environment
I used primefaces test project to reproduce the issue. Sample is using Mojarra 4.0.5 version.
The text was updated successfully, but these errors were encountered: