05 November 2007

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

Let us try to understand Struts framework in some what more detailed manner......


Step Wise Flow of Control Of Struts

1.First we see a Jsp/HTML page on our Web Browser,if it is this page is retrieved from Web.xml
File.
2.Their is a Web.xml file which is Deployment Descriptor.

Roles Of Deployment Descriptor
  • Locates the First JSP page which would pop up in the Web based Project.
  • It is responsible for mapping of JSP page to its equivalent servlet.
  • Information to Library file is also contained in this file.
  • Formating of address which is to be displayed as URL.It represent all those pages with .do extension which have more than one forward page, where a decision has to be taken which page needs to be displayed on the basis of the user input.
3.Now after Web.xml file which next happens to be the heart of a Strut application is
Struts-Config.xml.

Role Of Struts-Config.xml
  • Action Mapping-:Now Action Mapping means to map each JSP page to its corresponding Servlet, Bean class,Action class and Business Logic Class .
  • Local Forwards-: This tab contains Information about the all the possible JSP pages to which a given JSP page can redirect to on the basis of user input.
  • Local Exceptions-:This defines the error handling mechanism.
4.Before the data from form is stored in Bean class of the corresponding page Validator Framework comes into picture. This validator framework is responsible for server side validation of inputs.To introduce constraints on any field of form you will need to make changes in 2 files one is Valitator.xml and Validator-rules.xml.

Validator.xml describes the logic which needs to be check for each and every field of JSP form whereas Validator-rules.xml describes the location of the logic and gives name to each logic which is then used in Validator.xml. After data has been checked for compliance to standard rules values are stored in bean which are then further used as described in previous post of mine.




Sphere: Related Content

No comments: