user2771655
user2771655

Reputation: 1072

What is the use of defining <ui:fragment> tag in jsf

I am new to JSF. I read about tag. But I find only examples not about when to use and what if we don't use it? I want to know what is the real requirement for use of <ui:fragment> tag.

Is it really necessary at any point?

Can some body explain me with and without this what could be the output?

Upvotes: 4

Views: 5984

Answers (1)

user2771655
user2771655

Reputation: 1072

This is what i found by observing my existing project. Anybody can correct me if I am wrong.

I think this can be used, if you want to display some component based on the condition. So inside <ui:fragment> attribute 'rendered' can be used to control the display of fragment.

<ui:fragment rendered="#{rowStatus.index % 2 == 0}">
         <tr>
            <td width="16%">#{slots.dateStr}</td>
            <td width="65%">Day #{rowStatus.index + 1} (#{dailySlots.weekStr})</td>
                                <td width="4%">PM</td>
         </tr>
  </ui:fragment>

Upvotes: 6

Related Questions