[an error occurred while processing this directive]

JSF Static Navigation Example


This is a part of navigation in which one page is navigated to others. This section gives you something about the JSF Static navigation which makes the direct navigation between two or more pages. There is an example of Static Navigation in JSF has been implemented with the complete downloadable solutions like the example code and the illustration about the procedure of deployment of example. This type of the navigation navigate directly to the other sources which have to mentioned as it is.

Here, you will find the code of the example and can get more about the static navigation in the JSF application in very efficient manner. This type of navigation works like an anchor tag (<a href=""></a>) of HTML (Hyper Text Markup Language).

There is an example has been given in this section for illustrating the topic more conveniently. This example shows command button labeled with the text "Go to second page". When you will click on the button pages is referred to an another page. This application uses some files for completion the application as given as below:

  • firstpage.jsp
  • secondpage.jsp

Program Output as follows:

When you will click on the command button component it will show the output as follows:

Code for the firstpage.jsp file:

<%@ 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.</h4>

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/dtd/web-facesconfig_1_0.dtd">


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/dtd/web-app_2_3.dtd">


    <!-- 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.


[an error occurred while processing this directive]