以下是为科协备课时做的ssi例子中配置文件的摘要
1、beans.xml
<bean id="userAction" class="com.njupt.action.UserAction" scope="prototype">
<property name="service" ref="userService"></property>
</bean>
2、web.xml(这里给很可能会出现兼用性问题,主要体现为dtd验证没有通过,所以以下贴上所有代码)
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:beans.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
3、struts.xml(这里给很可能会出现兼用性问题,主要体现为dtd验证没有通过,所以以下贴上所有代码)
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<package name="ssi" namespace="/ssi" extends="struts-default">
<action name="UserAction_*" class="userAction" method="{1}">
<result name="listUser">/listUser.jsp</result>
<result name="listUserAfter" type="redirectAction">UserAction_listUser</result>
<result name="update">/updateUser.jsp</result>
</action>
</package>
</struts>
标签:xml,web,配置文件,代码,listUser,struts2,jsp,ssi From: https://blog.51cto.com/u_5290007/6251958