File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF conditional HTML

 
kent snow
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following code I would like to be displayed if a list in a backing bean contains one or more elements:

<div id="header_tabs">
<ul>
<li id="tab-payment" class="on">Adjustments</li>
<li id="tab-summary">Summary</li>
<li id="tab-confirmation">Confirmation</li>
</ul>
</div>

The text is always static. I tried to use <c:if but that could not find the value of my JSF backing bean. What is the best practice for this? Any suggestions even for a temporary fix?
 
Richard Green
Ranch Hand
Posts: 536
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use the rendered attribute of the h:div tag.
 
kent snow
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That only pertains to the DIV tag itself, not what is between the tag, so it does not solve the problem with the ul / li tags. I believe there is a list tag in the apache tag lib. However, does anyone know how I can use a rendered tag logic around a block of HTML between the tags to be displayed?

<f: ??? rendered=�my condition�>
<div >
<blah �>
<a �>
</div >
</f: ??? >
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kent snow:
That only pertains to the DIV tag itself, not what is between the tag, so it does not solve the problem with the ul / li tags.


Why doesn't it? If you turn the div off, the contents of the div will not be displayed, which is what you want, no?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic