首页 新闻 会员 周边

springmvc配置问题

1
悬赏园豆:40 [已解决问题] 解决于 2012-04-24 10:28

各位大家好!我配置的环境是weblogic10+spring2.5,我想用springmvc的整套的功能,当我自动添加了jar包后,生成一个applicationContext.xml这个文件,我自己在src下面(与applicationContext.xml同目录)建立了一个dispatcherContext-servlet.xml配置文件,请问我的applicationContext.xml文件要不要删掉,下面是我的web.xml和dispatcherContext-servlet.xml配置文件,麻烦帮我看看!这两个文件到底该怎么配啊

 

 

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation
="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
>

<!--

-->

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

<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/dispatcherServlet-servlet.xml</param-value>
</init-param>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/dispatcherServlet-servlet.xml</param-value>
</context-param>

<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>

 

 

 

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
<bean id="urlMapping" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" />
<bean id="simpleUrlhandlerMapping" class=
"org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"
>
<property name="mappings">
<props>
<prop key="/login.do">loginController</prop>
</props>
</property>
</bean>
<!-- 多处理解析 参数名action 值为controller的方法名-->
<bean name="methodNameResolver" class="org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver">
<property name="paramName">
<value>action</value>
</property>
</bean>

<!-- 视图解析模版 -->
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- 使用JSTL标签 -->
<property name="viewClass">
<value>org.springframework.web.servlet.view.JstlView</value>
</property>
<property name="prefix">
<value>/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<bean id="loginController" class="cn.gov.mof.web.UserController" />
</beans>

 

第一印象的主页 第一印象 | 初学一级 | 园豆:79
提问于:2010-11-30 16:31
< >
分享
最佳答案
0

多看看官方文档应该能解决

www.stoneiter.com

收获园豆:40
南京程序员俱乐部 | 菜鸟二级 |园豆:255 | 2010-11-30 17:23
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册