Integrating JSF with Spring Security
Let's create a simple Apache MyFaces application in Eclipse. Also let's integrate Spring Security to JSF, and then demonstrate basic authentication.
Getting ready
You will need Eclipse Indigo or a higher version
Create a dynamic web project JSF
In your Eclipse IDE, create a dynamic web project:
JSf_Spring_Security_Chapter_3_Recipe1
Create a source folder:
src/main/java
Create a package:
com.packt.jsf.bean
Create a Managed Bean:
User.java
Use Tomcat server to deploy the application
How to do it...
Perform the following steps to implement a basic authentication mechanism with JSF and Spring Security:
User.java
is the Managed Bean of the application. It has two methods:sayHello()
andreset()
:User.java class
:package com.packt.jsf.bean; public class User { private String name; private boolean flag= true; public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String sayHello...