Previous | Home | Next |
Answer: Yes. We can have more than one struts-config.xml.A sample configuration in web.xml file would look like this
<servlet> <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> <!-- module configurations --> <init-param> <param-name>config/exercise</param-name> <param-value>/WEB-INF/exercise/struts-config.xml</param-value> </init-param> <init-param> <param-name>config/upload</param-name> <param-value>/WEB-INF/upload/struts-config.xml</param-value> </init-param> </servlet>
Answer: The Valuator Framework is used for server side validation in Struts Framework.The server side validation of form can be accomplised by sub class of our From Bean with DynaValidatorForm class.
Answer: The role of the ActionMapping object to map a particular Action class.
Q.27 What happens internally when actionMappings.findForward("target") method is called in Action class?
The actionMappings.findForward("target") method returns the object of ActionForward. An ActionForward represents a destination to which the controller, RequestProcessor, might be directed to perform a RequestDispatcher.forward or HttpServletResponse.sendRedirect, as a result of processing activities of an Action class.
Q.28 Expalin JSP,Servlet Combination VS Struts Which is better and how?
Answer: jsp:forward is part of JSTL and will be used in JSP pages. It internally uses RequestDispatcher to forward the request to new jsp or servlet page. ActionForward is part of Struts framework and is used in Action class. It internally uses RequestDispatcher to forward the request to ActionServlet.
Previous | Home | Next |