HTML and CSS Reference
In-Depth Information
In the
logout()
method, the session is invalidated and the user is forwarded to the home page. Notice that all of
the application pages are using the
main.xhtml
template under
/WEB-INF/templates
folder. Listing 10-7 shows the
main.xhtml
template page.
Listing 10-7.
main.xhtml Template Page
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="
http://www.w3.org/1999/xhtml
"
xmlns:ui="
http://java.sun.com/jsf/facelets
"
xmlns:h="
http://java.sun.com/jsf/html
"
>
<h:head>
<title><ui:insert name="title">#{bundle['application.defaultpage.title']}</ui:insert></title>
<link href="#{request.contextPath}/css/main.css" rel="stylesheet" type="text/css"/>
</h:head>
<h:body>
<div id="container">
<div id="header">
<ui:insert name="header">
<h1>#{bundle['application.defaultpage.header.content']}</h1>
</ui:insert>
</div>
<div id="content">
<ui:insert name="content">
#{bundle['application.defaultpage.body.content']}
</ui:insert>
</div>
<div id="footer">
<ui:insert name="footer">
#{bundle['application.defaultpage.footer.content']}
</ui:insert>
</div>
</div>
</h:body>
</html>
The template uses
main.css
style file and it has three main parts: the header, the footer, and the content.
The content should be replaced by the different pages in the application (home, weather, and registration pages).
The application's text is externalized in the
messages.properties
file which is shown in Listing 10-8.
Listing 10-8.
messages.properties File
user.id = Username
user.password = Password
user.email = Email
user.fname = First name
user.lname = Last name
user.profession = Profession
user.zipCode = Zip code