springmvc web.xml spring-servlet.xml 配置

来源:互联网 发布:手办制作过程 知乎 编辑:程序博客网 时间:2024/06/06 12:27
<?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">          <context-param>         <param-name>contextConfigLocation</param-name>         <param-value>/WEB-INF/springmvc-servlet.xml</param-value>     </context-param>     <listener>         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>     </listener>                    <!--Character Encoding Convert-->     <filter>         <filter-name>encodingFilter</filter-name>         <filter-class> org.springframework.web.filter.CharacterEncodingFilter          </filter-class>         <init-param>             <param-name>encoding</param-name>             <param-value>utf-8</param-value>         </init-param>     </filter>     <filter-mapping>         <filter-name>encodingFilter</filter-name>         <url-pattern>*.do</url-pattern>     </filter-mapping>               <servlet>         <servlet-name>springmvc</servlet-name>         <servlet-class> org.springframework.web.servlet.DispatcherServlet          </servlet-class>      </servlet>     <servlet-mapping>         <servlet-name>springmvc</servlet-name>         <url-pattern>*.do</url-pattern>     </servlet-mapping>            <welcome-file-list>    <welcome-file>index.jsp</welcome-file>  </welcome-file-list></web-app>


<?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" xmlns:jee="http://www.springframework.org/schema/jee" xsi:schemaLocation="http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans-3.0.xsd  http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-3.0.xsd  http://www.springframework.org/schema/tx   http://www.springframework.org/schema/tx/spring-tx-3.2.xsd   http://www.springframework.org/schema/jee   http://www.springframework.org/schema/jee/spring-jee.xsd">      <!-- 自动搜索@Controller标注的类 -->    <context:component-scan base-package="com.zuxiang.web" />    <!-- Default ViewResolver -->    <bean id="viewResolver"        class="org.springframework.web.servlet.view.InternalResourceViewResolver">        <property name="viewClass"            value="org.springframework.web.servlet.view.JstlView" />        <property name="prefix" value="/" />        <property name="suffix" value=".jsp"></property>    </bean>       <bean id="messageSource"        class="org.springframework.context.support.ResourceBundleMessageSource"        p:basename="i18n/messages" /></beans>


0 0
原创粉丝点击