Jsf login logout project

Preview:

Citation preview

JSF Login Logout Project

-Gagandeep Singh

What this example does

This example demonstrates authentication mechanism and allows users to have secure access to the application by validating the username and password.

We will be using JSF view for login, DAO object ,HttpSession for session management and JSF managed bean and Oracle database.

In Next slides you will see step by step how the project grows from organic level to a full functional Login Logout functionality

Step 1: Create the table Users in Oracle database

Project Explorer View

Before we move on to our project related code, below image shows the project structure in Eclipse. Just create a dynamic web project and convert it to maven to get the project stub and then keep on adding different components.

Step 2: Create Dynamic Web Project

Convert the project to Maven

Download Maven Plugin from Eclipse Marketplace

In order to convert your dynamic web project to a Maven project you will have to ensure that the Maven plugin is configured with your IDE. Since we are using Eclipse Juno, m2e plugin needs to be installed using Eclipse Marketplace

https://marketplace.eclipse.org/content/maven-integration-eclipse-wtp-juno-0

Drag the iinstall from the above link to the current Eclipse Juno workspace

Step 3: Create the login JSF page login.xhtml

Login.java

Step 4: Create the managed bean Login.java

Step 5: Create the DataConnect.java classDataConnect.java

Step 6: Create the LoginDAO.java classLoginDAO.java

Step 7: Create SessionBean.javaSessionBean.java

Step 8: Create the authorization filter classAuthorizationFilter.java

Step 9: Create admin.xhtml

Step 10: Edit faces-config.xml and web.xml

Copy ojdbc6.jar in the Tomcat lib folder Install ojdbc folder from Oracle webstore and copy it on to the Tomcat/lib directory

Run Configuration on Server

Validate the userid and password fields

Recommended