Struts Interview Questions and Answers
Struts 1 vs Struts 2 | Struts 1.1 vs Struts 1.2 | Struts 1.2 vs Struts 1.3 |
Ques 1. What helpers in the form of JSP pages are provided in Struts framework?
There are 4 major JSTLs (JSP Standard Tag Libraries) provided in Struts as JSP helpers. Those tag libraries are described in TLD (Tag Library Descriptor) files:
struts-html.tld - Tags to help generating HTML elements.
struts-form.tld - Tags to help generating HTML FORM elements.
struts-bean.tld - Tags representing some JavaBeans like: cookie, header, message, and page.
struts-logic.tld - Tags representing Boolean logic operations.
Ques 2. Is Struts efficient?
The Struts is not only thread-safe but thread-dependent(instantiates each Action once and allows other requests to be threaded through the original object.
ActionForm beans minimize subclass code and shorten subclass hierarchies
The Struts tag libraries provide general-purpose functionality
The Struts components are reusable by the application
The Struts localization strategies reduce the need for redundant JSPs
The Struts is designed with an open architecture--subclass available
The Struts is lightweight (5 core packages, 5 tag libraries)
The Struts is open source and well documented (code to be examined easily)
The Struts is model neutral
Ques 3. How you will enable front-end validation based on the xml in validation.xml?
The < html:javascript > tag to allow front-end validation based on the xml in validation.xml. For example the code: < html:javascript formName=logonForm dynamicJavascript=true staticJavascript=true / > generates the client side java script for the form logonForm as defined in the validation.xml file. The < html:javascript > when added in the jsp file generates the client site validation script.
Ques 4. What is ActionServlet?
The class org.apache.struts.action.ActionServlet is the called the ActionServlet. In the the Jakarta Struts Framework this class plays the role of controller. All the requests to the server goes through the controller. Controller is responsible for handling all the requests.
Ques 5. How you will make available any Message Resources Definitions file to the Struts Framework Environment?
Message Resources Definitions file are simple .properties files and these files contains the messages that can be used in the struts project. Message Resources Definitions files can be added to the struts-config.xml file through < message-resources / > tag. Example: < message-resources parameter= MessageResources / >