• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Probably a daft question

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
but been thrown in the deep end a bit with some JSF stuff!

Can anyone please tell me how to test for a string in the following example instead of a int?

<h:graphicImage value="/images/Flag.gif" rendered="#{line.status.ID == 2}"/>

I need to check if line.status = "TEST STRING" then & only then display the image?

thanks ever so much in advance, will sit down when time & learn it properly!
 
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Harry,

You could use jstl to test the scenario you mentioned.

change
<h:graphicImage value="/images/Flag.gif" rendered="#{line.status.ID == 2}"/>

to

<c:if test="${line.status eq 'TEST STRING'}">
<h:graphicImage value="/images/Flag.gif" rendered="#{line.status.ID == 2}"/>
</c:if>

Before using <c:if> you should include the common taglib in your jsp using "<taglib>" tag.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
rendered="#{line.status.ID == 'TEST STRING'}"
 
Ranch Hand
Posts: 376
Scala Monad
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Gregg Bolinger:
rendered="#{line.status.ID == 'TEST STRING'}"


Also you put the test string in a bundle and use

rendered="#{line.status.ID == myBundle.TEST_STRING}"
 
This cake looks terrible, but it tastes great! Now take a bite out of this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic