Term
|
Definition
|
|
Term
|
Definition
- Action Servlet
- struts-config.xml
- Action Mapping (defined in struts-config.xml )
- Action
- ActionForm
- ActionForward
- ActionMessages
|
|
|
Term
|
Definition
- org.apache.struts.action.ActionServlet
- acts as the FrontController or Controller (in MVC)
- sends the request to a component in the web container based on action mappings defined in the struts-config.xml
- Standard J2EE Servlet
- Starts the flow of control defined in the RequestProcessor.
- Overrides doGet and doPost methods to call process method
- Specified in web.xml like any other servlet:
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern> |
|
|
Term
Request/Response round trip |
|
Definition
1. Browser sends request – passed to J2EE server 2. Web Container of J2EE server invokes ActionServlet 3. ActionServlet finds an ActionMapping for request 4. ActionMapping indicates which Action to invoke 5. Action works with ActionForm 6. Action calls business objects as needed 7. Action returns an ActionForward to the ActionServlet – Forward is usually to a JSP view that is presented to a user |
|
|
Term
|
Definition
<action-mappings> <action path="/logon" type="stocktraderweb.actions.LogonAction" name="logonForm" scope="request" validate="false"> <forward name="success" path="./welcome.jsp"/> <forward name="unauthorized" path="./unauthorized.jsp"/> </action>
</action-mappings> |
|
|
Term
|
Definition
- Not a Servlet.
- Parses URI and determines requested action.
- Maps params to ActionForm (form bean)
- Calls appropriate Action's execute method.
- OR Calls appropriate ActionForward to pass off control flow.
|
|
|
Term
|
Definition
- aka FormBean
- Form encapsulated as an object
- uses Java bean conventions
- it can also provide validation code by overriding the validate() method.
|
|
|
Term
|
Definition
- Should control flow - NOT logic.
- Wrapper around business logic.
- Business logic s/b in model layer, not action.
- Sometimes described as Adapters - they provide the necessary interface to the Model layer.
|
|
|
Term
Predefined Struts Actions
|
|
Definition
Predefined Ations in Struts:
- DispatchAction
- LookupDispatchAction
- ForwardAction
- IncludeAction
- SwitchAction
|
|
|