Book Image

Mastering JavaServer Faces 2.2

By : Anghel Leonard
Book Image

Mastering JavaServer Faces 2.2

By: Anghel Leonard

Overview of this book

Table of Contents (20 chapters)
Mastering JavaServer Faces 2.2
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
The JSF Life Cycle
Index

Removing the content with <ui:remove>


The <ui:remove> tag is used for removing the content. This tag is rarely used, but a perfect example of this is removing comments of type <!-- -->. You probably thought of something like the following line:

<!-- <h:outputText value="I am a comment!"/> -->

It doesn't have any side effects on the HTML rendered code. Well, that isn't true, because in the HTML source code, you will see something similar to the following screenshot:

But if we encapsulate this in <ui:remove>, then the preceding client side effect will not be produced anymore, which has the following code.

<ui:remove>
  <!-- <h:outputText value="I am a comment!"/> -->
</ui:remove>

The same effect will have the following code:

<ui:remove>
  <h:outputText value="I am a comment!"/>
</ui:remove>

In order to remove comments from the generated HTML code, you add the context parameter in web.xml, as shown in the following code...