Term
What is an ActionServlet? |
|
Definition
An ActionServlet is the central component of the Struts Controller.
It is a concrete class that extends javax.servlet.HTTPServlet. |
|
|
Term
In which file is Struts configuration information stored? |
|
Definition
/WebContent/WEB-INF/config/struts-config.xml
|
|
|
Term
What is the RequestProcessor? |
|
Definition
It is the place where the request processing takes place in a Struts controller enviroment. |
|
|
Term
Where is the mapping from URL Path to an Action class defined? |
|
Definition
Within the ActionMapping section of the struts-config.xml file.
< action-mapping > |
|
|
Term
What is an ActionForm (a.k.a. Form Bean)? |
|
Definition
It is a JavaBean that extends ActionForm. It contains the data entered from the form (User Interface) on the client side. |
|
|
Term
What is the signature of the execute() method in Action class? |
|
Definition
public ActionForward execute (ActionMapping mapping, ActionForm form, HTTPServletRequest request, HTTPServletResponse) throws Exception. |
|
|
Term
What is an ActionForward? |
|
Definition
ActionForward is a class that encapsulates the next view information, using a associative name for the next JSP page. |
|
|
Term
What are the various ways of doing form validation in Struts?
(Hint: 3) |
|
Definition
1. Using Javascript for client-side validation.
2. Using Struts Validator framework.
3. Overriding the validate() in the Struts form class and use ActionErrors. |
|
|
Term
|
Definition
A new feature which allows form-beans to be declared inside struts-config.xml, instead of a ActionForm Class.
The type attribute must be “org.apache.struts.action.DynaActionForm” |
|
|
Term
What is DynaValidatorForm? |
|
Definition
DynaValidatorForm is an extension of DynaActionForm and provides basic field validation based on an XML file. |
|
|
Term
What are the 5 steps in the Validator Framework? |
|
Definition
1. Ensure that the plug-in is set in struts-config.xml.
2. Set validate = true & define 'input' attribute.
3. Define DynaValidatorForm.
4. Map validator rules to appropriate fields in validation.xml.
5. Set html:errors in the JSP page. |
|
|
Term
How does the RequestProcessor work? |
|
Definition
When the ActionServlet intercepts a HTTP request, it delegates the request handling to another class called RequestProcessor by invoking its process() method. |
|
|
Term
What two important things does an ActionServlet perform? |
|
Definition
a. On startup, it reads the Struts Configuration file and loads it into memory in the init() method.
b. In the doGet() and doPost() methods, it intercepts HTTP request and handles it appropriately. |
|
|