JSF Global Navigation Example

This is a part of navigation in which one page is navigated to others. This section gives you something about the JSF Global navigation which makes the direct navigation between two or more pages.

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<head><title>Navigation Page</title></head>

<h1>This is the first page.</h1>
<h:commandButton value="Go to second page" 
action="secondpage" />

Code for the secondpage.jsp file:

<h4>This page is navigated by the firstpage.jsp that has been 
mentioned in the faces-config.xml file.

Code for the faces-config.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.
//DTD JavaServer Faces Config 1.0//EN" "http://java.sun.com


Code for the web.xml file:

<?xml version="1.0"?> 
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.
//DTD Web Application 2.3//EN" "http://java.sun.com


    <!-- Faces Servlet -->
        <servlet-name>Faces Servlet</servlet-name>
        <load-on-startup> 1 </load-on-startup>

	<!-- Faces Servlet Mapping -->
        <servlet-name>Faces Servlet</servlet-name>

Download This Complete Example.