Struts 1 - Intermed

MVC Architecture Identify how Struts implements the MVC2 pattern :
  • Name the Struts classes respectively corresponding to Model, View and Controller components.
  • Describe the typical request-response lifecycle of a Struts-based application.
    • The request comes to the ActionServlet controller that delegates to Action.
    • The ActionForm is filled by Struts with the request parameters and is given to the Action.
    • Based on the struts-config data the request is forwarded to a JSP page.
  • Identify the front controller pattern implemented by Struts, with the ActionServlet.
  • Know the purpose of Separation of business logic from the presentation, and how Struts implements this feature.
  • Finally, list the benefits of MVC Architecture.
    • The ease of separating the real code into separate classes, beans, and custom tags.
    • MVC approach is needed when a single request will result in multiple substantially different-looking results.
    • When there is a large development team with different team members doing the Web development and the business logic.
Configuration Write a correct Struts web application deployment descriptor web.xml file
  • Configure the ActionServlet instance using the <servlet> element
  • Explain the meaning of the following ActionServlet init parameters : application, mapping, config, debug.
  • Configure the ActionServlet mapping using the <servlet-mapping> element
  • Configure the Struts Tag Libraries using the <taglib> element, list the standard tld files.
Write and understand struts-config.xml file such as the following :
  <struts-config>
    <form-beans>
      <form-bean  name="logonForm" type="app.LogonForm"/>
    </form-beans>
    <action-mappings>
       <action path="/Welcome" forward="/pages/Welcome.jsp"/>
       <action path="/Logon"  forward="/pages/Logon.jsp"/>
       <action path="/LogonSubmit" type="app.LogonAction" 
               name="logonForm" scope="request" 
               validate="true" input="/pages/Logon.jsp">
         <forward name="success" path="/pages/Welcome.jsp"/>
         <forward name="failure" path="/pages/Logon.jsp"/>
       </action>
       <action path="/Logoff" type="app.LogoffAction">
         <forward name="success" path="/pages/Logoff.jsp"/>
       </action>
    </action-mappings>
    <message-resources parameter="resources.application"/>
  </struts-config>
  • Write correct forms and actions definitions using <form-beans>, <form-bean>, and <action>
  • Define local and global forwards using <forward> inside <action> and <global-forwards>
  • Map Actions classes <action-mappings>
  • Configure bundles to externalize strings messages using <message-resources>
  • Configure PlugIn using <plug-in>
Form Beans & Action Classes
  • The Struts framework provides several components that make up the Control layer of a MVC-style application. These include a controller component (servlet), developer-defined request handlers, and several supporting objects.
    • Writing an ActionForm class by extending the org.apache.struts.action.ActionForm class and using the validate() and reset() methods.
    • Writing an Action class by extending the org.apache.struts.action.Action class and working with either execute() or perform() method.
  • When initialized, the controller parses a configuration file (struts-config.xml) and uses it to deploy other control layer objects. Together, these objects form the Struts Configuration.
    • The Configuration defines the ActionMappings i.e., org.apache.struts.action.ActionMappings for an application.
  • Know the sequence of events that occur when a request calls for n mapping that uses an ActionForm:
    • The controller servlet either retrieves or creates the ActionForm bean instance.
    • The controller servlet passes the bean to the Action object.
    • If the request is being used to submit an input page, the Action object can examine the data. If necessary, the data can be sent back to the input form along with a list of messages to display on the page. Otherwise the data can be passed along to the business tier.
    • If the request is being used to create an input page, the Action object can populate the bean with any data that the input page might need.
  • Also, understanding the DispatchAction and its subclasses, their purposes.
Validator Framework
  • Validator plug-in
  • About org.apache.struts.validator package.
  • Benefits of using the Validator.
  • Understanding the components of the Validator Framework.
  • ValidatorActionForm class and methods.
  • validation.xml and validation-rules.xml
Dynamic Forms
  • Importance of Dynamic forms and the requirement of usage.
  • About the org.apache.struts.action.DynaActionForm and the org.apache.struts.validator.DynaValidatorForm.
  • Understanding the get and set methods of DynaActionForm and using inside the execute method of Action class.
  • Configuring DynaActionForm and DynaValidatorForm inside struts-config.xml file.
  • Using the HttpServletRequest object in connection with the Dynamic forms.
Exception Handling
  • Understanding the importance of exception handling in Struts.
  • Understanding the ActionError and ActionErrors classes.
  • Using the ActionErrors and ActionMessages classes.
  • Customizing the ExceptionHandler class.
  • <global-exceptions> in struts-config.xml file.
  • Creating the separate config files and configuring them through the web.xml using the <init-param>.
I18N
  • Understanding the internationalization and its importance for the web applications.
  • Defining the resource bundles of properties files with two-letter ISO language code.
  • Configuring the resource bundles in struts config or deployment descriptor.

Struts Tag Libraries
  • Understanding the importance of tag libraries
  • Location of the tag libraries
  • About the usage of Html, Bean and Logic Tags in the presentation layer of the application
  • Html form components
  • Beans message and write tags
  • Logic tags usage for performing the programming constructs in the presentation tier of the application

你可能感兴趣的:(apache,bean,jsp,mvc,struts)