What is for <html:base/> tag in the HTML tag library defined in the Struts.
The <html:base/> tag is used to insert an HTML <base> element, including an href pointing to the absolute location of the hosting JSP page. This tag allows you to use relative URL references, rather than a URL that is relative to the most recent requested resource. The <html:base/> tag has no body and supports two attributes:
* target : Represents the target attribute of the HTML <base> tag (optional)
* server : Identifies a server name to use in the href as opposed to the result of a call to request.getServerName() (optional)Reply
What are the steps involved in installing the HTML tag library in your Struts application?
To use HTML tag library in web application, You must complete the following steps:
* Copy the TLD file packaged with this tag library struts-html.tld) to the webapps/MyAppName/WEB-INF directory.
* Make sure that the struts.jar file is in the webapps/MyAppName/WEB-INF/lib directory.
* Add the following <taglib> sub-element to the web.xml file of the Web application:
You must add the following taglib directive to each JSP that will leverage the HTML tag library:
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>Reply
How will you configure Plugins in your struts configuration file?
The <plug-in> element is used to add Plugins to the Struts Controller. Struts Plugins are useful when allocating resources or preparing connections to databases or even JNDI resources. The <plug-in> element has a single attribute, className, which is used to define the fully qualified Plugin class.
<plug-in className="Fully qualified plugin class name" />Reply
How will you add a message Resource in your struts config file?
The <message-resources> element is used to describe a MessageResources object for the containing application.
<message-resources parameter="configuration parameter" key="main" />
The attribute of a <message-resources> Element: className, factory, key, null, parameter.Reply
Describe the attributes of <action> sub-element?
The attributes of <action> Sub-Element:
* path : Represents the context-relative path of the submitted request.
* type : Specifies the fully qualified class name of the Action class being described by this ActionMapping.
* name : Identifies the name of the form bean, if any, that is coupled with Action being defined.
* scope : Specifies the scope of the form bean that is bound to the desired Action. The default value is session.
* input : Represents the context-relative path of the input form to which control should be returned if a validation error is encountered.
* className : Specifies the fully qualified class name of the ActionMapping implementation class you want to use in when invoking this Action class.
* forward : Represents the context-relative path of the servlet or JSP resource that will process this request.
* include : Represents the context relative path of the servlet or JSP resource that will process this request. This attrubute is used if you do not want an Action to service the request to this path.Reply
What is for <action-mapping> sub elements in struts config file?
The <action-mapping> sub-element is used to define n-number of <action> sub-elements. It acts as a container for <action> sub-elements.
The <action> sub-element is used to describe an Action instance to the ActionServlet.
What is Global forwards and define its attributes in struts config file?
The <global-forwards> sub-elementis used to define n-number of <forward> sub-elements that are available to any Action in the Struts Application. It acts as a container for public <forward> sub-elements.
You can use <forward> sub-elements to describe a mapping of a logical name to a context relative URI path. A forward is used to identify the target of an Action class when it returns its result.
The Attributes of a <forward> sub element:
* name : Contains the unique identifier identifying this target.
* path : Specifies the Context relative path of the targeted resource.(required)
* redirect : If set to true, causes the ActionServlet to use the HttpServletResponse.sendRedirect() method, as opposed to RequestDispatcher.forward() method, when sending the Action results to the targeted resourse. The default value is false.(optional)Reply
What are the various attributes of an <exception> sub-element in struts config file?
The attribute of an <exception> sub-element:
* bundle : A ServletContext attribute that names the resource bundle associated with the ExceptionHandler handling the defined <exception> elements.
* className : The fully qualified class name of the configuration bean associated with the defined handler.
* hanler : The fully qulified class name of the ExceptionHandler that will process the contained <exception> sub-element.
* key : Used to retrieve the message template associated with this exception.
* path : The module-relative path that will act as the target of the ExceptionHandler associated with this exception.
* scope : The scope of the ActionError object coupled with this exception.(optional)
* type : The fully qualified class name of the exception defined by this <exception> sub-element.(required).Reply
How you can add the Global exception in your configuration file?
The <global-exception> sub-element is used to define n-number of <exception> sub-elements that are throwable by any Action in a Struts application. This sub-element acts as a container for all public <exception> sub-element.
The <exception sub-element> is used to associate a global exception with an ExceptionHandler.
The following declaration in struts-config.xml:
How will you add FormBean Definitions in your struts configuration file?
The <form-bean> sub-element is used to describe an instance of a FormBean that is later bound to an Action.
<form-bean name="unique bean name" type="fully qualified class name">