Table of ContentsPart 1: Introduction and Functional Specs
Part 2: Java classes
Part 3: XML configuration
Part 4: HTML Files
Part 5: Running the Application
- Spring core 3.1.0.RELEASE
- Spring Security 3.1.0.RELEASE
- Spring Data JPA 1.1.0.M1
- See pom.xml for details
To access the source code, please visit the project's Github repository (click here)
Functional SpecsBefore we start, we define our application's specs as follows:
- Two types of users: admin and regular users
- A login page that's accessible to all types of users, including unauthorized users
- All other pages are visible to registered users only
- A home page
- A user page
- An admin page which is visible only to admins
DatabaseAs mentioned earlier, our application relies on a custom database schema to obtain its users.
The database contains two tables: user and role tables.
User tableThe user table contains personal information of each user. Notice the password values are hashed using Md5.
Role tableThe role table contains role values of each user. We define a role value of 1 as an admin, while a role value of 2 as a regular user.
ScreenshotsBefore we start the actual development, let's preview how our application should look like by providing screenshots. This is also a good way to clarify further the application's specs.
The login page contains two input fields: a username and a password field.
Login failure page
When a user fails to login, the login page is displayed again with an error message Login Failure! at the bottom.
When a regular user logs-in, the user should be redirected to the home page with Home, User, and Logout pages accessible to the user.
When an admin user logs-in, the user should be redirected to the home page with Home, User, Admin, and Logout pages accessible to the user.
Logout success page
When a user successfully logs out, the login page is displayed again with a success message Logout Success! at the bottom.
NextIn the next section, we will discuss the project's structure and start writing the Java classes. Click here to proceed.
Share the joy:
Subscribe by reader Subscribe by email Share