How to Define Title Header in JSF File without using ui Tag in Java Web Application

Posted on

Introduction

Actually, this article has a connection with the previous one. It is because the subject has a similar content material with that one. That is an article with the title of ‘How to Define Title Header in JSF File using ui Tag in Java Web Application’ which exist in this link. Similar with the previous article, it is using the same setting and configuration with that previous article. There are two important prerequisites as for executing the Java web application in this article. First of all, it is creating a Java web application using maven tool in this link. It is an article with the title of ‘How to Create maven-based Web Application in NetBeans IDE’. The second one is the requirement for adding JSF library functionality for the Java web application in an article in this link. That article has the title of ‘How to Add JSF Library to a maven-based Web Application in NetBeans IDE’.

Define Title of the Header in JSF File without using ui Tag

In this article, the step for defining the title which exist in the header of the JSF file is actually the same. Those steps are in the following sequence :

  1. First of all, just access the Java web application’s project in the NetBeans IDE in this case.

  2. Create a new file with the name of ‘index-title-header.xhtml’ for an example.

  3. Fill the content of that file with the following content :

    <?xml version='1.0' encoding='UTF-8' ?>
    <!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Transitional//EN"
              "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:ui="http://java.sun.com/jsf/facelets">
          <h:head>
               <title>Default Title</title>
          </h:head>
    </html>
  4. Last but not least, just build, compile and run the Java web application. The following image will appear as the page with the appearance of the title’s header :

    How to Define Title Header in JSF File without using ui Tag in Java Web Application
    How to Define Title Header in JSF File without using ui Tag in Java Web Application

    In other words, the output of the page is the same where the title of the header appears. Either with or without using the ui tag.

Leave a Reply