Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL and boolean properties  RSS feed

 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a need to display custom boolean values on a web page using either JSTL or Struts taglibs. What I mean by "custom boolean values" is that I've got a JavaBean with a method like "public boolean isActive()" and I want to display either "yes" or "no" on the web page instead of "true" or "false".

How should I do this? Please tell me I don't have to use scriptlets...

Right now, I have the following which prints "true" or "false":
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you can do is use the Choose tags


Besides this,you need to create your own pretty print tag. or over ride the method in your Object with getYesNoActive method

In item class add


Change your tag to

[ January 30, 2005: Message edited by: Carl Trusiak ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Carl Trusiak:
Besides this,you need to create your own pretty print tag. or over ride the method in your Object with getYesNoActive method

Ah. So obvious and yet I didn't see that... Thanks, Carl!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Under JSP 2.0 EL it can done via:



The EL provided with JSTL 1.0 lacks the ? operator.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!