• 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

rendering certain icons based on value

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have three icons for color coding 'status' value of the jsp segment shown below. Currently, it is displaying the value of '1', '2' & '3' for status. Wondering what would be the best way to render one of the three color icons on the page based on the values above?
Code snippets would help a great deal as I am a newbie to JSF/JSP.

Thanks


<h:column id="T5column2">
<f:facet name="header">
<h:outputText styleClass="MyoutputTextWhite" value="Status"
id="T5text3"></h:outputText>
</f:facet>
<h:outputText styleClass="outputText" id="T5text4value="#{varDataRow.i_STATUS}">
</h:outputText>
</h:column>
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use the rendered attribute.
 
Tariq Ahsan
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know I have to use the rendered. But my problem is this rendering is conditional. Based on the return value of 1, 2, or 3 the corresponding gif image of yellow, green or red icons will be displayed on the page.
Any idea how that can be done?

Thanks
 
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tariq,

You will have you create 3 controls and render them depending upon your condition. You can use the "rendered" attribute for this.

For example say if you want to display 3 outputText elements then you can use following code



So using this code, outputText with value="1" will be rendered when status value is "1" and so on.

Hope it helps
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic