• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL ternary ?  RSS feed

 
Andrew Mcmurray
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I am trying to use the JSTL ternary opp to set a var, like so


Is this not allowed? If not what is the best way to do this?

Thanks,

Jutah
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It'd save a lot of time if you would follow forum guidelines and point out what versions of JSP and JSTL you are using.

The terniary operator is only supported in the JSP 2.0 EL, and not the pseudo-EL provided by JSTL 1.0.
[ September 05, 2006: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your syntax is very incorrect. I can't even tell what you are trying to do. Please explain.
 
Andrew Mcmurray
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear,

Sorry JSP 2.0. I know the the opp works because I am using it in other places. What I am trying to do is if user.status returns true then I want to set a status var to "*" that will be used in a display next to the user's name. If it is not true then I want to set the var to something else now I have the "=" as an example. I think I need to switch my var name too from status to something else, I didn't realize that was a key var.

Thanks,

AMD
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<c:set var="status" value="${user.status ? '*' : '='}"/>
 
Andrew Mcmurray
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah I see thanks Bear

AMD
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!