Can I compare "@ binding value" with another value inside if attribute

asked 2009-12-02 12:34:36 +0800

chuxuanhy gravatar image chuxuanhy

Can I do the following operation?
For example :
<button if="@{Reservation.Status=='Waiting'}" label="Accept" forward="onClick=onAccept"/>

Or is there any way to do the same? I am binding with @ way not $ way.
Please help me, thanks in advance.

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2009-12-17 10:59:03 +0800

subscriber gravatar image subscriber
57 2 2

yea i have same problem. but no solution yet:(

link publish delete flag offensive edit

answered 2009-12-17 11:03:52 +0800

caclark gravatar image caclark
1753 2 5

No, the databinder only uses the expression as a retrieval mechanism and not as a full blown EL type expression. It does not evaluate the expression as EL would, but only as a compound attribute retrieval as JSP EL would.

link publish delete flag offensive edit

answered 2009-12-17 17:36:37 +0800

robertpic71 gravatar image robertpic71
1275 1

* EL's can inlcude logik like compares, but only evaluated during the first rendering. (as Cary wrote: it's JSP stuff)
* Databinding is binding-only, but in both-ways and dynamic

"if" is renderoption - there is no databinding available.

Variant 1:
Mix EL's and databinding, use if="${..." instead - but the button keeps his state after rendering

Variante 2:
Use the visible attribute with code inside the controller or model.
<button visible="@{win$composer.waiting}" label="Accept"/>

and offer an:

public boolean isWaiting() {
   return reservation.getStatus().equal("Waiting");

Check also this thread for detailed discussion.


link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2009-12-02 12:34:36 +0800

Seen: 540 times

Last updated: Dec 17 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More