java4all@1986 java. Powered by Blogger.

>> Friday, June 17, 2011

Q).How would you display “validation fail” errors on a JSP page?
A).Following tag displays all the errors:
 <html:errors/>


Q).What are the various steps involved in the implementation of Struts?
A).The struts framwork models its server side implementation of the MVC using a combination of JSPs, custom JSP tags, and a Java Servlet. It involves the following steps :

  * The incoming request is received by the ActionServlet, which acts as the controller, and the ActionServlet looks up the requested URI in an XML file.
  * The ActionClass performs its logic on the Model components associated with the application.
  * Once the Action has completed its processing, it returns control to the ActionServlet with a key that indicates the result of its processing. ActionServlet uses this key to determine where this result should be forwarded for presentation.
  * The request is complete when the ActionServlet response by forwarding the request ot the view that was linked to the returned key, and this view presents the result of the Action.

Q).Which method is use to forward the result to the appropriate view in the Action class in Struts? 
A).ActionMapping Class's findForward(String) method...
in ActionClass ActionMapping is Passed as Parameter so we do not need to create Seprate instance for that .

Q).What are Struts Plug-In?
A).Struts Plugins are modular extensions to the Struts COntroller. They are defined by the org.apache.struts.action.Plugin interface.  Struts Plugins are useful are useful when you are allocating resources or preparing connections to the databases or even JNDI resources.
This interface defines two lifecycle mathods: init() and desstroy().

Q).What are the steps involved in Struts Plugins?
A).All Plugins must implement the two Plugin methods init() and destroy(). To develop your own Plugin You must complete the following steps:
  * Create a class that implements the org.apache.struts.action.Plugin interface.
  * Add a default empty contructor to the Plugin implementation. You must have a default constructor to ensure that the ActionServlet property creates your Plugin.
  * Implement both the init() and destroy() methods and your implementation.
  * Compare the new Plugin and move it into the web applocation's classpath.
  * Add a <plug-in> element to the application's struts-config.xml file describing the new Plugin.

  Q).What is RequestProcessor? How will you create your own RequestProcessor?
  A).The RequestProcessor is the class that you need to override when you want to customize the processing of the ActionServlet. It contains a predefined entry point that is invoked by the Struts controller with each request. The entry point is the processPreprocess() method.
Steps involved in creation your own RequestProcessor:
  * Create a class that extends the org.apache.struts.action.RequestProcessor class.
  * Add a default empty constructor to the RequestProcessor implementation.
  * Implement your processPreprocess() method.

  Q).How will you configure the Plugin in your web application.?
  A).To deploy and configure your Plugin class, you must:
  * Compile and move the Plugin class file into your application's WEB-INF/classes/ directory.
  * Add a <plug-in> element to your struts-config.xml file. For example:
    <plug-in className="MyPlugin"/>
    The <plug-in> element should be the last element in the struts-config.xml file.
  * Restart the Web application.

  Q).What is the difference between the ForwardAction and the IncludeAction in the Struts?
  A).The main difference between the ForwardAction and the IncludeAction is that you need to use IncludeAction only if the action is going to be included by another action or JSP.
Therefore, if you have code in your JSP that looks like this:
  <jsp:include page="/someWebApp/someModule/someAction.do"/>
the action could not use a ForwardAction because it would forward control to the new action rather than including its output within the output of the JSP, or throw a IlligalStateException if the output buffer is already committed.

Q).What is an ActionMapping?
A).
  An ActionMapping object describes an Action instance to the ActionServlet. It represents the information that uniquely defines an instance of a particular action class. The values defined by an ActionMapping object are what make a particular <action> definition unique.
The ActionMapping object also provides useful information to the Action.execute() method, giving an Action object the ability to alter its behaviour based on the values describing a particular ActionMapping instance. The signature of the Action.execute() method:

public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response).

Q).How will you create your own ActionMapping?
A).
To create your own ActionMapping extention, you have to perform the following steps:
  * Create a class that extends the org.apache.struts.action.ActionMapping class.
  * Define the additional properties that will be used to describe your Action objects.
  * Call the super() method, which calls the ActionMapping's default constructor at the beginning of your action mapping's contructor.
  * Define matching setters and getters that can be used to modify and retrieve the values of the defined properties.

0 comments:

Post a Comment

FaceBook Login

HTML/JAVASCRIPT

HTML/JAVASCRIPT

HTML/JAVASCRIPT

HTML/JAVASCRIPT

Total Pageviews

STATCOUNTER

  © Blogger template Simple n' Sweet by Ourblogtemplates.com 2009

Back to TOP