Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

rendering certain icons based on value  RSS feed

 
Tariq Ahsan
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • 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">
<hutputText styleClass="MyoutputTextWhite" value="Status"
id="T5text3"></hutputText>
</f:facet>
<hutputText styleClass="outputText" id="T5text4value="#{varDataRow.i_STATUS}">
</hutputText>
</h:column>
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the rendered attribute.
 
Tariq Ahsan
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • 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
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • 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
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!