Wednesday 23 May 2012

Introduction about Struts Resources

Struts Resources

Resources of  struts application development
1.Jsps
2.Action Servlet
3.Web.xm
4.Struts configuration file
5.Form Bean class/ Action form class
6.Action class
7.Action Forwards
8.Action Error/Action Messages


1.JSPs:
    These web resource programs represent presentation logic of view layer having the capabulity of generating user interface and formatting the result generated by business logic of the application. It is always recommended to develop jsp’s of struts application as javacode less jsp’s. for This the programmers can use following tags
a)Built-in tags of jsp technology except <scriptlet>,<declaration> and <expression>
b)JSTL tags (jsp’s standard library tags)
c)Struts supplied jsp tags
d)3rd Party supplied jsp tags
e)Custom jsp tags

2.Action Servlet:
       a built-in servlet of HTTp Servlet supplied by struts software. Action servlet acts as controller in struts based web application. Action servlet contains pre defined logic to generate this integration logic dynamically.
Struts based application are MVC-II Architecture based webapplication so the struts application contains only one servlet as controller i.e ActionServlet. Due to this Programmer should not take user defined servlets in struts application

3.Web.xml:
          This file is called deployement descriptor of web application. This file in struts application contains action servlet configuation and jsp tag libraries configuration. Even Though Action Servlet class is built in servlet its configuartion in web.xml file must be done by the programmer explictly. The underlaying web server software reads web.xml file and recogins

 4.FormBean/ActionForm:
  it is the java bean class supplied by programmer in controller layer as helper resource to controller servlet called action servlet having the ability to store form data of form page and uses this form data to perform form validations by executing form validation logic.
a java bean class that extends from predefined org.apache.struts.action.ActionForm class is called form bean class.

5.Action Class
       it is the programmer supplied java class in struts application extending  from the predefined “org.apache.struts.action.Action” when we place business logic in the action class it acts as model layer resource. When you place logic to communicate with model layer components or applications like EJB components. Spring application and etc in Action class then Actionclass is called helper resource to controller servlet called ActionServlet.

6.ActionForward
        These are xml entries in struts configuration file pointing to results pages(JSP) of action classes using which the results generated by action classes will be formatted by executing the presentation logic. Action Servlet uses this configuration to decide the result page of Action Class. es the configurations.

7.Struts Configuration File:
      This is the heart of the struts application containing guide lines, configurations and instructions that are required to generate  integration logic of controller servlet dynamically. Any filename.xml can acts as struts configuration file.
ActionServlet reads content of struts configuration file using xml parser called SAX parser.
Struts Configuration file contains FormBean,classes configurations,Action Class configuration, ActionForwards configuration pointing to results pages of action classes, plug-ins configuration & etc.

8.Action Messages/ActionErrors
     A class that encapsulates messages. Messages can be either global or they are specific to a particular bean property.
Each individual message is described by an
ActionMessage object, which contains a message key (to be looked up in an appropriate message resources database), and up to four placeholder arguments used for parametric substitution in the resulting message.





No comments:

Post a Comment