Struts configuration

AWTaglib relies heavily on Spring Framework and Struts Framework (This kind of dependency is planned to be reduced)



You should add the following action mappings to your struts-config.xml:



< action

path="/resource"

type="org.springframework.web.struts.DelegatingActionProxy"

unknown="false"

validate="false"

>

< /action >

< action

path="/report"

type="org.springframework.web.struts.DelegatingActionProxy"

parameter="dispatch"

unknown="false"

validate="false"

>

< /action >

Also, don't forget to add the Spring Plugin so the application can correctly map the actions.



awtaglib.xml is inside awtaglib.jar, so you just have to tell Spring to look for it in the classpath



< plug-in className="org.springframework.web.struts.ContextLoaderPlugIn" >

< set-property property="contextConfigLocation" value="classpath:/awtaglib.xml"/ >

< /plug-in >

web.xml Configuration

You should add the following lines to your web.xml:



< context-param >

< param-name > contextConfigLocation < /param-name >

< param-value >

classpath:/awtaglib.xml

< /param-value >

< /context-param >

This parameters are optional, but you should add them so you can debug your application in case something goes wrong:

< context-param >

< param-name > log4jConfigLocation < /param-name >

< param-value > /WEB-INF/classes/log4j.properties < /param-value >

< /context-param >

< context-param >

< param-name > webAppRootKey < /param-name >

< param-value > app.root < /param-value >

< /context-param >

Next, you should register the following listeners, so Spring loads the required context:

< listener >

< listener-class > org.springframework.web.context.ContextLoaderListener < /listener-class >

< /listener >

< listener >

< listener-class > org.springframework.web.util.Log4jConfigListener < /listener-class >

< /listener>

It is equally important to configure Strut's servlet, or else the taglib won't work



< 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 >

< load-on-startup > 1 < /load-on-startup >

< /servlet >

< servlet-mapping >

< servlet-name > action < /servlet-name >

< url-pattern > *.do < /url-pattern >

< /servlet-mapping >

Also, don't forget the mime mapping, so you don't have trouble when you export to excel!

< mime-mapping >

< extension > xls < /extension >

< mime-type > application/vnd.ms-excel < /mime-type >

< /mime-mapping >