config-browser是struts的一个插件,它能够帮助你查看运行时框架所有Action的配置状况,非常有用。加入config-browser插件非常简单,不过需要引入Spring才能使用。
1、将struts2-config-browser-plugin-2.0.9.jar、spring-context.jar、spring-beans.jar、spring-web.jar、spring-core.jar放到/WEB/lib目录下。
2、/WEB 目录下新建一个 applicationContext.xml文件,内容可以是:- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
- <beans></beans>
3、在web.xml中插入
xml 代码
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
4、struts.xml中插入
xml 代码
<include file="struts-plugin.xml"/>
5、最后就可以通过localhost:8089/struts2/config-browser/index.action这样的URL去访问,整个插件在config-browser namesapce下运行。