The communication between files or modules.
1. Action Servlet
2. JSP's
3. Web.xml
4. ActionBeans / FormBean
5. ActionClass
6. ActionForward
7. Struts Configuration file
1. ActionServlet : Builtin controller servlet of struts based web application this converts integration logic generated by framework software dynamically.
2. JSP's : View layer components having presentation logic it is recommended to develop JSP's of struts application as java less JSP's by using standard JSP's tags or JSP technologies,JSTL tags struts supplied JSP calass library tags and custom JSP tag library tags.
3.Web.xml : It is a deployment descripter file of web application having configuration of built in action servlet. This files also contains JSP tags library configuration, welcome file configuration.
Note: Even through action servlet is built in servlet, its configuration in web.xml using servlet
Note: Struts based web applications are MVC architectured based web-applications and there will be one servlet in the entire web application, that is action servlet acting as controller.
4. ActionForm/FormBean: (it is a JavaBean class): It is a programmer developed java bean class as helper class to controller servlet called action servlet FormBean class object stores form data send by browse and received by action servlet.
FormBean class contains form validation logic. Form Bean is a JavaBean having capability to store form data.And also capable of validating form data.
A JavaClass/JavaBean class that extends from org.apache.struts.action.ActionForm is called FormBean class predefined ActionForm class is an abstract class containing no abstract methods.
Q : What is need of FormBean class in Struts application.
A : Verifying the format of the form data is called form validation.
- In MVC based web applications this logic must be available in controller Servlet.Struts applications are MVC based web applications. And the built in controller servlet does not give any form validation logic an does not allow to keep form validation logic directly in it. But programmer wants to write form validation logic. For this struts frame work software makes action servlet to receive form data by trapping request and makes to store form data in user defined java class object. This user defined java class is nothing but FormBean class.
- Since FormData is visible and accessible in FormBean class the programmer also places form validation logic in FormBean Class.
5. ActionClass : (programmer supplied java class) : If business logic is kept directly in Action class then it acts as model. If Action class is having logic to interact with other model layer components/applicaitons like EJB components spring with Hibernate applications or any other business component, then Action class is called as helper to controller called Action Servlet.
Q : What is the need of ActionClass.?
A : If Business logic of struts based web application is available in EJB Component or in Spring with Hibernate application the controller servlet called ActionServlet is supposed to interact with these model Layer EJB components Spring with Hibernate applications. Since ActionServlet is builtin Servlet we can't place above said integration logic in ActionServlet. So we place this integration logic is the helper class to controller called ActionServlet . This helper class named as ActionClass.
As part of struts application flow of execution the request trapped by ActionServlet definitly tries to execute the logics of appropriate FormBean class, Action class once. The java class that extends from org.apache.struts.action.ActionServlet class is called Action class of struts application.
6. Action-forward: This is an XML entry specifing result JSP page of Action class. Based on these configuration the business logic execution result goes to result JSP page, where the presentation logic of result JSP page formats the result and sends formatted result as response to the browser.
7. Struts configuration file :
(any filename)(.xml file)
This xml file contains guidelines required for the Action servlet, Framework software to generate Integration logic dynamically. This file contains FormBean classes configuration Action classes configuration,action-forward configurations and plugins configuration like validates plugins,files plugins.
Based on this files instuctional configurations the Action servlet will decide FormBean , Action class to be utilize to process the request when action servlet traps request given by the browser.
Entries kept in web.xml will be read by webContainer of webserver / application server. These entries kept in struts configuration file will be read by struts frame work software and ActionServlet.