Showing posts from May 1, 2005

0 to struts in 60 minutes

Steps to build a struts application

Struts has become a standard for web applications. It lets you fit your web application in a MVC framework - which earlier I had wrongly thought - MVC is only for desktop GUI clients.

What is MVC?


Model deals with the data - JavaBeans containing the data.
View deals with how you want to display the model
Controller - How the model and view are to be controlled

Lets take the example of a login process.

Here is the scenario : User enters login name, password hits submit. The form data are sent to a servlet that talks to the database to see if the information is valid. If it is valid, it puts the name, role information in a javabean and sends the browser to a welcome page. If not it sends the browser an error page.

Now with MVC scenario. When the user hits submit, the control does not directly go to the servlet but to a controller servlet. The form values are put in a javabean ( model ). The controller's main job is to see what the…