Wednesday, December 25, 2013

Struts

1. Struts2 is configured in web.xml file using filter and filter-mapping tags as below
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
        <init-param>
         <param-name>config</param-name>
         <param-value>struts-default.xml,struts-plugin.xml,/resources/struts.xml</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
 2. The default location of struts.xml can be changed by giving the desired location in init-param of filter tag as given above.
3. Properties file can be accessed in struts2 using  a  constant in struts.xml as below:-
<constant name="struts.custom.i18n.resources" value="resources/ApplicationResources" />
4. Struts tags can be used in jsp files using taglib directives as below:-
<%@ taglib uri="/struts-tags" prefix="s" %>
 

No comments:

Post a Comment

SpringBoot Application Event Listeners

When a spring boot application starts few events occurs in below order ApplicationStartingEvent ApplicationEnvironmentPreparedEvent Applicat...