Hello,
On a commandbutton, I want to condition the value 'update' according to a boolean, like this:
If boolean is true: <p: commandButton ... update = "a b c">
If boolean is false: <p: commandButton ... update = "d e f">
I do not know how to code the EL expression. Something like this:
<p: commandButton ... update = "# {bean.boolean == true: a b c, bean.boolean == false: d e f}"
Thanks a lot for your help.
CommandButton : EL expression for Update
-
- PrimeFaces Core Developer
- Posts: 3979
- Joined: 03 Dec 2010, 14:11
- Location: Bavaria, DE
- Contact:
Thomas Andraschko
PrimeFaces | PrimeFaces Extensions
Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE
Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko
PrimeFaces | PrimeFaces Extensions
Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE
Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko
-
- Posts: 409
- Joined: 28 Dec 2011, 17:44
For a JSF beginner it can be confusing, but you can simply use shorthand if (like mentioned above) to return 2 different strings:
Code: Select all
#{bean.boolean ? 'a b c' : 'c d e'}
Primefaces 8.0.7 (PF Extensions 8.0)
JSF: Mojarra 2.3.2 (Spec 2.3) - running on WildFly 22
JSF: Mojarra 2.3.2 (Spec 2.3) - running on WildFly 22
-
- Information
-
Who is online
Users browsing this forum: No registered users and 26 guests