Demo Applications Using Struts

Aim

The main Aim of this Deliverable is to learn Struts and develop a Basic application using the same.

Software Needed

Implementation

In Struts, first we have to write an ActionForm that maintains the session state web application. ActionForm in this project is LoginForm.java. This ActionForm extends the ActionForm class. LoginForm takes the input from the user and validates the form. The Validate () method is used to validate the inputs. If any of the fields is left empty or entered incorrectly, error messages are added to the ActionMapping object. The ActionForm object is automatically populated on the server side with data entered from a form on the client side. It must have setters and getters for all the form fields. The ActionForm class is pre-populated with form data when the form is submitted.

The view component usually is made up of JSP (Java Server Pages). JSP can contain the static HTML. In this deliverable the JSP pages are login.jsp success.jsp, failure.jsp. Login.jsp is our form for entering the login details like username/login ID and password. User enter the values in the form and click on the submit form. Form validation is done on the server side and error message will displayed on the jsp page if there are any.

In the welcome page,If any of the columns are left empty or entered incorrectly then the user will be redirected to failure.jsp, which prompts the user to enter the Login details again correctly. If all the details are entered correctly, it will be redirected to the success.jsp.

Code

The code can be obtained from the following link.
Download the Sturts code rar