ryskajakub
ryskajakub

Reputation: 6431

What tag to use to hide content in JSF

When I want to hide some content in JSF, what tag is made for this purpose? There are several tags that can do the job:

<f:subview rendered="#{...condition...}" />

and

<c:when test="#{...conditon...}" />

Which is the right one to use?

Upvotes: 3

Views: 1247

Answers (2)

amorfis
amorfis

Reputation: 15770

<ui:remove>

Look here: http://www.jsftoolbox.com/documentation/facelets/10-TagReference/facelets-ui-remove.html

UPDATE

If you want to conditionally hide some content, you can use

<h:panelGroup rendered="#{...condition...}">

It renders as <span>, you can also add attribute layout="block"

<h:panelGroup rendered="#{...condition...}" layout="block">

to render it as <div>.

Upvotes: 0

Dejell
Dejell

Reputation: 14317

in JSF, using rendered is the best approach.

Using JSTL tags like <c:when>, is not recommended at all, and even break some functunality of JSF like ViewScope annotation. Always try to use JSF tags (like ui:repeat instead of c:forEach)

Upvotes: 2

Related Questions