<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> <property name="exceptionMappings"> <props> <prop key="org.springframework.dao.DataAccessException"> dataAccessFailure </prop> </props> </property> </bean> <!-- Activates @Autowired for Controllers --> <context:annotation-config/> <!-- ①:对web包中的所有类进行扫描,以完成Bean创建和自动依赖注入的功能 --> <context:component-scan base-package="com.mobileares.dolphin.webapp"/> <!-- ②:启动Spring MVC的注解功能,完成请求和注解POJO的映射 --> <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/> <bean id="filenameController" class="org.springframework.web.servlet.mvc.UrlFilenameViewController"/> <bean id="fileUploadController" class="com.mobileares.dolphin.webapp.controller.FileUploadController"> <property name="validator" ref="beanValidator"/> <property name="cancelView" value="redirect:mainMenu.html"/> <property name="formView" value="uploadForm"/> <property name="successView" value="uploadDisplay"/> </bean> <bean id="passwordHintController" class="com.mobileares.dolphin.webapp.controller.PasswordHintController"> <property name="userManager" ref="userManager"/> <property name="messageSource" ref="messageSource"/> <property name="mailEngine" ref="mailEngine"/> <property name="message" ref="mailMessage"/> </bean> <bean id="reloadController" class="com.mobileares.dolphin.webapp.controller.ReloadController"/> <bean id="signupController" class="com.mobileares.dolphin.webapp.controller.SignupController"> <property name="validator" ref="beanValidator"/> <property name="formView" value="signup"/> <property name="successView" value="redirect:mainMenu.html"/> <property name="userManager" ref="userManager"/> <property name="roleManager" ref="roleManager"/> <property name="mailEngine" ref="mailEngine"/> <property name="message" ref="mailMessage"/> <property name="templateName" value="accountCreated.vm"/> </bean> <!-- <bean id="userFormController" class="com.mobileares.dolphin.webapp.controller.UserFormJason"> /<property name="validator" ref="beanValidator"/> <property name="formView" value="userForm"/> <property name="successView" value="redirect:users.html"/> <property name="cancelView" value="redirect:mainMenu.html"/> <property name="userManager" ref="userManager"/> <property name="roleManager" ref="roleManager"/> <property name="mailEngine" ref="mailEngine"/> <property name="message" ref="mailMessage"/> <property name="templateName" value="accountCreated.vm"/> </bean> --> <!-- Add additional controller beans here --> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="maxUploadSize" value="12097152"/> </bean> <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basename" value="ApplicationResources"/> <property name="useCodeAsDefaultMessage" value="true"/> </bean> <!--<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">--> <!--<property name="mappings">--> <!--<value>--> <!--/admin/activeUsers.html=filenameController--> <!--/admin/reload.html=reloadController--> <!--/admin/users.html=userController--> <!--/mainMenu.html=filenameController--> <!--/passwordHint.html=passwordHintController--> <!--/contractlist.html=contractController--> <!--/duebilllist.html=duebillController--> <!--/speciallist.html=specialController--> <!--/creditlist.html=creditController--> <!--/init.html=initController--> <!--/main.html=mainController--> <!--/urgenttask.html=urgentTaskController--> <!--</value>--> <!--</property>--> <!--<property name="order" value="0"/>--> <!--</bean>--> <!--<bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping">--> <!--<property name="order" value="1"/>--> <!--</bean>--> <!-- View Resolver for JSPs --> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="requestContextAttribute" value="rc"/> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="prefix" value="/WEB-INF/pages/"/> <property name="suffix" value=".jsp"/> <property name="order" value="2"/> </bean> <!----> <bean name="jsonViewResolver" class="org.springframework.web.servlet.view.XmlViewResolver"> <property name="order" value="0"/> </bean> <bean id="beanNameViewResolver" class="org.springframework.web.servlet.view.BeanNameViewResolver"> <property name="order" value="1"/> </bean> </beans>
1.web.xml文件的配置
猜你喜欢
转载自zcw-java.iteye.com/blog/1246937
今日推荐
周排行