26 October 2007

Struts- MVC Architecture Contd...............

This figure depicts an M-V-C Architecture.
M-Model
V-View
C-Controller

Model- That part of application which deals with database creation, insertion and retrieval of data is know as Model. Programming of database can be done through JDBC, hibernate and other database languages.


View - These are the dynamic or static web pages which can be created using JSP , JSF etc. These are similar to HTML tags in many ways only additional thing which they enable is the support for JAVA which makes them far more powerful than HTML tags.

Controller-This is that part of your application which process each request sent by web browser and decides upon which next page should be displayed.

Form Bean- These are those classes which store values of parameters filled in a given form. Each JSP page has a form bean where the value of all parameters or fields is set or reset.

Now i will try to explain the flow of control from the above picture step by step

  1. Web browser sends a request to server.
  2. Servelet take this request and first stores all the parameter(Fields) value which where filled in the form to the corresponding Form bean of the page.
  3. Then Servlet goes to Action class which is the controller of your application. This class helps determining the next JSP page on the basics of Field or parameter values which it retrieve from bean.
  4. Action class interacts with Business Logic for retrieving desired data from database.
  5. Then data is sent to the next JSP page selected by the Action Class.
  6. JSP is then sent to Web Browser.



Sphere: Related Content

1 comment:

ARCHANA said...

i have found your blog when i was googling for struts flow...u have explained in a very simple words to be understood by anyone..