Magazine
 

Developing Simple Application with - JSF

Many of the web-based applications consists of login module which lets the user enter with its own identity and also let the admin authenticate the user or differentiate between the registered and normal user. So every user should have identification strings like user id and password. This section explains how to develop this application in JSF.

This application displays a web page indicating the user to enter login id and password in the appropriate fields. If user enters correct information then a message indicating successful login is displayed otherwise failing message is
displayed. For this application login id and password are given below:

Login ID: JavaJazzUp

Password : mypwd

Before proceeding further, just have a look over directory structure of the application. It would help you to understand where to put which files and folders.

Directory Structure

 

Now we will go through all steps involved developing this application assuming you are comfortable installing Tomcat server and configuring JSF in it.

1 Create JSP pages
2 Create managed bean class
3 Register managed bean in configuration file
4 Define navigation rule in configuration file
5 Run the application

Creating JSP pages

1. login.jsp

<%@ page contentType=”text/html”%>
<%@ taglib uri=”http://java.sun.com/jsf/
core” prefix=”f”%>
<%@ taglib uri=”http://java.sun.com/jsf/
html” prefix=”h”%>
<f:view>
<html>
<head><title>JSF Login Application</title>
</head>
<body>
<h:form>
<table>
<tr>
<td>
<h:outputText value=”Enter Login ID: “ />
</td>
<td>
<h:inputText id=
“id” value=”#{LoginBean.loginid}” />
</td>
</tr>
<tr>
<td>
<h:




Nov 2007 | Java Jazz Up | 43
 
previous
index
next
 
View All Topics
All Pages of this Issue
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,

30
, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 , 54, 55, 56, 57,

58
, 59, 60, 61, 62, 63 , 64, 65 , 66 , 67 , 68 , 69   Download PDF