• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSTL and boolean properties

 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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":
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Under JSP 2.0 EL it can done via:



The EL provided with JSTL 1.0 lacks the ? operator.
reply
    Bookmark Topic Watch Topic
  • New Topic