zoukankan      html  css  js  c++  java
  • Spring MVC配置详解(2)---bai

    web.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">
    	<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>*.html</url-pattern>
    	</servlet-mapping>
      <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>
    </web-app>
    

      

    springmvc-servlet.xml:
    
    <?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-3.0.xsd
    	 http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    	
    	<!-- 配置注解的扫描路径。控制器包中 -->
    	<context:component-scan base-package="com.etc.controller"/>
    	
    	<!-- 创建1个视图解析器,支持jsp -->
    	<bean id="viewResovler" 
    		class="org.springframework.web.servlet.view.UrlBasedViewResolver">		
    		<!-- 视图文件的前缀 -->
    		<property name="prefix" value="/WEB-INF/jsp/"/>
    		<!-- 视图文件的后缀 -->
    		<property name="suffix" value=".jsp"/>
    		<!-- 视图文件的具体类型 -->
    		<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>	
    	</bean>
    	
    	
    </beans>
    

      

  • 相关阅读:
    Android命名规范(重点讲解:包名)
    ADT中创建Android的Activity
    Android页面切换
    js技巧
    记一次查询超时的解决方案The timeout period elapsed......
    Timeout expired 超时时间已到. 达到了最大池大小 错误及Max Pool Size设置
    SQL索引详解
    php 微信公众号接入支付宝支付
    【MVC】关于Action返回结果类型的事儿(上)
    H5网站接入支付宝的支付接口
  • 原文地址:https://www.cnblogs.com/ipetergo/p/6272264.html
Copyright © 2011-2022 走看看