Ques: 7 What are the parameters used in the Action.execute()
method in the Struts.
Ans: The following parameters
are used in the Action.execute(...) method :
* ActionMapping : The
ActionMapping class contains all of the deployment information for a particular
Action object. This class is used to determine where the result of the class
(that extends the Action class) will be sent once its processing is complete.
* ActionForm : Represents
the form inputs cntaining the request parameters from the view referencing this
Action bean.
* HttpServletRequest :
Reference to the current Http request object.
* HttpServletResponse :
Reference to the current Http response object.
Ques: 8 Which mathod is use to forward the result to the
appropriate view in the Action class in Struts?
Ans: The findForward() method
is use to forward the result to the appropriate view in the Action class. This
method takes the paremeter name for the view file to which the result is being
forwarded.
Ques: 9 How will you tell the web application and container about
your ActionServlet?
Ans: This can be accomplished
by adding the following servlet definition to the web.xml file :
<servelt>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Once you told the container about the ActionServlet you need to
tell it when it should be executed by adding <servelt-mapping> element in
web.xml file :
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
This mapping tells the web application that whenever a request is
received with .do appended to the URL then the servlet named action should
service the request.
Ques: 10 What are the
various struts controller components?
Ans: Four distinct Struts Controller components:
* The ActionServlet class
* The Action class
* Plugins
* RequestProcesser
Ques: 11 What is ActionServlet class in the struts controller?
Ans: The
org.apache.struts.action.ActionServlet is the backbone of all Struts
application. It is the main controller component that handles the client
request and determines which org.apache.struts.action.Action will process each
received request. It serves as an Action factory - creating specific Action
classes based on the user's request.
Ques: 12 What is the entry point to ActionServlet when a request
comes in.
Ans: The two main entry point
into the ActionServlet are the same as any other servelt : doGet() and
doPost().They call single method named process(). The struts specific behaviour
begin with this mehtod.
Ques: 13 What is the process() method doing in the ActionServlet
class?
Ans: The process() method
gets the current RequestProcessor and invokes the RequestProcessor.process()
method.The RequestProcessor.process() method is where the current request is
actually serviced. This method retrieves from the struts-config.xml file, the
<action> element that matches the path submitted on the request. It does
this by matching the path passed in the <html:form/> tag's action element
to the <action> element with the same path value.
0 comments:
Post a Comment