2:03 am - Saturday January 21, 2017

What is MVC In java with Example Program

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

Struts MVC Architecture: 

MODEL-VIEW-CONTROLLER 

Model: 

The model  contains the business logic and interact with the persistence storage to store, retrieve and manipulate data.

View:

The view is responsible for display the results back to the user. In Struts the view layer is implemented using JSP.

Controller:

The controller handles all the request from the user and selects the appropriate view to return. In Struts the controller’s job is done by the  ActionServlet.

The following Process  happen when the Client browser hits an HTTP request.

  1. The ActionServlet  receives the request.
  2. The struts-config.xml  file control the  ActionsActionForms,ActionMappings and ActionForwards.
  3. While execute the  ActionServelet  reads the struts-config.xml file and creates a database of configuration objects. Then processing the request the  ActionServlet  makes decision by referring to this object.

 

After ActionServlet receives the request it does the following actions.

  1. JavaBean class which extends Struts ActionForm class.
  2. Decides which action class to invoke to process the request.
  3. Validate the data  entered by the user.
  4. The action class process the request with the help of the model component. The model interacts with the database and process the request.
  5. Finally the Action class returns an ActionForward to the controller.
  6. Depends on the ActionForward the controller will invoke the appropriate view
  7. The Final step is HTTP response is back to the user by the view component

 

sample

BACK

Filed in: Z-AStruts Codes

No comments yet.

Leave a Reply