java4all@1986 java. Powered by Blogger.

>> Friday, June 17, 2011

Q).What will happen if the mapping to actionform in the struts-config.xml is mentioned wrong?
A).An excetion will be thrown. If we try to cast the action form and using it, then it will throw nullpointer exception.

Q).Is Action class is Servlet or Not ? if yes why ?
A).Action class extents org.apache.struts.action.Action which has nothing to do with Servlet. Its a plain java class which is been called/Managed by a well defined framework called Struts.

Q).What are the contents of web.xml and struts-config.xml? What is the difference between them? How to relate these tow xml files?
A).A web.xml file is the DD (deployment descriptor) for any web based application while struts-config.xml is for specifically struts based application. A web.xml file establishes connection between application and container whereas struts-config.xml bridges gap between view and controller. A web.xml file is read by container when we start the container. struts-config.xml file is used by init() method of ActionServlet.

Q).Can I have more than one struts-config.xml file for a single Struts application?
A).Yes! One can have more than one struts-config.xml file for a single Struts application. You can define different struts-conifg.xml file for different modules in a single web application. It is useful when you are developing a distributed application.
But you must enter those struts-config.xml files details in deployment descripter (i.e., web.xml) file.

Example:
<init-param>
<param-name> config</param-name>
<param-value>/WEB-INF/struts-first-config.xml,/WEB-INF/struts-second-config.xml,/WEB-INF/struts-third-config.xml</param-value>
</init-param>

Here three struts configutation files are deployed in a single application.

Q).Yes! One can have more than one struts-config.xml file for a single Struts application. You can define different struts-conifg.xml file for different modules in a single web application. It is useful when you are developing a distributed application.
But you must enter those struts-config.xml files details in deployment descripter (i.e., web.xml) file.

Example:
<init-param>
<param-name> config</param-name>
<param-value>/WEB-INF/struts-first-config.xml,/WEB-INF/struts-second-config.xml,/WEB-INF/struts-third-config.xml</param-value>
</init-param>

Here three struts configutation files are deployed in a single application.
A).The web container do not need to know about the design pattern we used in our application. Our Struts application is deployed in the web.xml file. The container reads the web.xml file, and acts accordingly.

Q).Explain about token feature in Struts?
A).The problem of duplicate form submission arises when a user clicks the Submit button more than once before the response is sent back. This may result in inconsistent transactions and must be avoided.
In Struts this problem can be handled by using the saveToken() and isTokenValid() methods of Action class. saveToken() method creates a token (a unique string) and saves that in the user's current session, while isTokenValid() checks if the token stored in the user's current session is the same as that was passed as the request parameter.

Q).How you will save the data across different pages for a particular client request using Struts?
A).You can use the session object to save the data across different pages for a particular client request using Struts.
Create an appropriate instance of ActionForm that is form bean and store that form bean in session scope. So that it is available to all the pages that for a part of the request.

request.getSession()
session.setAttribute().

Q).Describe the details of XML files used in the “Validator Framework”?
A).The Validator Framework uses two XML configuration files:
  * validator-rules.xml and
  * validation.xml.
The validator-rules.xml defines the standard validation routines. These are reusable and used in validation.xml to define the form specific validations. The validation.xml defines the validations applied to a form bean.

Q).What is LookupDispatchAction?
A).The LookupDispatchAction is an abstract Action that dispatches to the subclass mapped execute method. This is useful in cases where an HTML form has multiple submit buttons with the same name. The button name is specified by the parameter property of the corresponding ActionMapping.

Q).What're the types of controllers?
A).There are two types of Controllers in Strus.
   1.Main Controller/FrontController
       Ex: ActionServlet
   2.Application Controller
       Ex:Action Class.

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