Monday, March 31, 2008

STRUTS INTERVIEW QUESTIONS


Q.In struts what happens if made any changes in actionservlet?

The ActionServlet plays the role of controller wich is responsible for handling the request and selecting the correct Application Module and storing ApplicationConfig and MessageResource bundle in the request object. If we modify the ActionServlet the Controller may or may not work what happens that depends on your modification, You have not specify whether you want to create your own custom ActionServlet by extending ActionServlet and overriding the methods in it or what exactly you want to modify.


Q.What part of MVC does Struts represent ?


Struts is mainly famous for its Action Controller - which is nothing but the CONTROLLER part of MVC Pattern. To add up, Struts is the framework which started mainly using the MVC-2 Pattern where in the Business logic is STRICTLY SEPARATED from the Presentation logic


Q.What is Struts?

Struts is a java framework based on Model 2 architecture of JSP or popularly called Model-View-Controller architecture.It provides a controller for this architecture.


Q.How you will handle errors and exceptions using Struts?

Struts exception handling can be done by two ways:1. Declarative (using struts features via struts-config.xml) This makes coding in the Action class very simpleSince the execute method declares throws Exception we don't need a try-catch block.Struts saves the exception using one of its global constants. You may use the field G lobals.EXCEPTION_KEY to retrieve it from the request object.2. Programmatic (using the usual try-catch exception handling in Action Class).





Q.What are the Important Components of Struts?

Struts Configuration File

ActionServlet
RequestProcessor
ActionForm
Action
ActionFroward
ActionMapping
ActionErrors



Q.How you will save the data across different pages for a particular client request usingStruts ?

Several ways. The similar to the ways session tracking is enabled. Using cookies, URL-rewriting, SSLSession, and possibilty threw in the database.



0 comments: