Invalidating session in struts2
Once we will be done with all the changes, our application will look like below image. Here is our controller class that defines two URIs that we can access. They should be same as configured in the spring security configurations.and pages are simple, but we could have included some information here based on the user details.Let’s look into each of the components of our Spring security example project. Our spring security example application is ready to test, note that for JDBC authentication I am using the same setup as our previous Spring Security Example.Step 1: Create the table Users in mysql database as 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.
When I say life cycle, I can hear you murmur “Oh no not again, how many life cycles I have to deal with”! Also a method is written to perform logout by invalidating HTTPSession attached. If the username and password does not match an error message is displayed as “Incorrect username and password” . We will be using JSF view for login, DAO object , Http Session for session management, JSF managed bean and mysql database. Note that database operations code is not optimized to be used in a real project, I wrote it as quickly as possible because the idea is to learn authentication in JSF applications. Lets now look in detail as how to create a JSF login logout authentication mechanism in JSF application.