我的spring配置文件
1、web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" 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">
<display-name>Spring_MVC</display-name>
<welcome-file-list>
<welcome-file>hello.jsp</welcome-file>
</welcome-file-list>

<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value> 
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>2、applicationContext.xml
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xmlns:jee="http://www.springframework.org/schema/jee"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd"
> <!-- 参数方法解析器,对应methodNameResolver -->
<bean id="paraMethodResolver" class="org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver">
    <property name="paramName">     
     <value>method</value>  
    </property>
    <!--没写method参数就调用默认的list方法--> 
    <property name="defaultMethodName"> 
     <value>list</value>
    </property>
</bean>

<!-- 定义添加数据库操作处理器(控制器) -->
<!-- 使用多动作控制器接口的MultiActionController -->
<bean id="dataView" class="chinare.com.cn.control.dataView">
<property name="methodNameResolver">
<ref bean="paraMethodResolver" />
</property>
<property name="loginDao">
<ref bean="loginDopx"/>
</property>
<property name="viewdata_success">
<value>viewsuccess</value>
</property>
<property name="viewdata_fail">
<value>viewfail</value>
</property>
</bean>

<!-- 定义url处理器 -->
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="dataView.do">dataView</prop>
</props>
</property>
</bean>
 
<!-- 连接MySQL数据库(连接池设置)-->
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java:comp/env/jdbc/db2_report</value>
</property>
</bean>
 
<!-- 定义数据访问对象,在loginDaoImpl类中引用数据源(模型) -->
<!-- loginDaoImpl表示一个接口的实现 -->
<bean id="loginDaoImpl" class="chinare.com.cn.model.loginDaoImpl"> 
<property name="dataSource">
<ref bean="dataSource"/>
</property>
</bean>
 
<!-- 配置事物管理器 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
</bean>

<!-- 动态代理的配置,事物模板 -->
<bean id="loginDopx" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager"/>
</property>
<!-- 动态代理的目标对象,该对象必须实现一个接口 -->
<property name="target">
<ref bean="loginDaoImpl"/>
</property>
<!-- 设置事物属性 -->
<property name="transactionAttributes">
<props>
<prop key="*Insert">PROPAGATION_REQUIRED</prop> <!-- 对名称中含有insert的函数纳入事务管理范围 -->
<prop key="*Update">PROPAGATION_REQUIRED</prop> <!-- 对名称中含有Update的函数纳入事务管理范围 -->
<prop key="*Delete">PROPAGATION_REQUIRED</prop> <!-- 对名称中含有Delete的函数纳入事务管理范围 -->
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> <!-- 对名称中含有get的函数以只读的事务处理机制进行处理 -->
</props>
</property>
</bean>

<!-- jsp文件前后缀封装  -->
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.JstlView</value>
</property>
<property name="prefix">
<value>/WEB-INF/jsp/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
</beans>3、我chinare.com.cn.control.dataView文件public class dataView extends MultiActionController
{
private static Logger log = Logger.getLogger(dataView.class);
public ILoginDao loginDao;
public String viewdata_success;
public String viewdata_fail; public ILoginDao getLoginDao() {
return loginDao;
} public void setLoginDao(ILoginDao loginDao) {
this.loginDao = loginDao;
} public String getViewdata_success() {
return viewdata_success;
} public void setViewdata_success(String viewdata_success) {
this.viewdata_success = viewdata_success;
} public String getViewdata_fail() {
return viewdata_fail;
} public void setViewdata_fail(String viewdata_fail) {
this.viewdata_fail = viewdata_fail;
} public ModelAndView dataViewHandle(HttpServletRequest arg0, HttpServletResponse arg1) throws Exception 
{
ModelAndView mv = new ModelAndView(viewdata_success); return mv;
}
}我的jsp文件都放在web-inf/jsp文件夹下,为什么返回页面总是报The requested resource (/工程名/viewsuccess) is not available.
错呀,添加web文件前后缀不起作用,请大家帮帮忙。