spring mvc的配置
来源:互联网 发布:怎么开淘宝活动 编辑:程序博客网 时间:2024/05/18 03:40
web.xml文件的配置:
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <filter> <filter-name>CharacterEncodingFilter</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>CharacterEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter> <filter-name>sitemesh</filter-name> <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class> </filter> <filter-mapping> <filter-name>sitemesh</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <servlet> <servlet-name>user</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>user</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping></web-app>
需要在WEB-INF目录下创建一个user-servlet.xml文件(这个user是你在web.xml中配置的那个user,必须保持一致):
<?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:context="http://www.springframework.org/schema/context"xmlns:mvc="http://www.springframework.org/schema/mvc"xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsdhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"><mvc:annotation-driven/><context:component-scan base-package="cn.edu.zttc.controller"></context:component-scan><mvc:resources location="/resources/" mapping="/resources/**"/><bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"><property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/><property name="prefix" value="/WEB-INF/jsp/"></property><property name="suffix" value=".jsp"></property></bean></beans>
需要用的jar包如图所示:
- Spring MVC的配置
- Spring mvc的配置
- spring mvc的配置
- spring mvc的配置
- Spring MVC的配置
- Spring的MVC配置详解
- spring web mvc的配置
- spring mvc的基本配置
- spring MVC的配置方法
- spring mvc 的配置解释
- spring mvc的详细配置
- spring mvc+spring+mybatis的配置
- Spring Boot对Spring MVC的配置
- 【spring mvc】spring-mvc配置
- 从零开始的spring mvc,spring mvc简单配置
- spring mvc的web.xml的配置
- Spring MVC框架的高级配置
- Spring MVC验证的配置步骤
- 深入了解Struts2返回JSON数据的原理及具体应用范例
- MFC dialog使其子控件CStatic等transparent的方法
- 几个数据分析网站
- MD5算法java实现
- 【deep learning学习笔记】最近读的几个ppt(二)
- spring mvc的配置
- Updating Maven Project:Unsupported IClasspathEntry kind=4错误解决
- 黑盒自动化测试的关键点有三个
- 标准IO库
- UVaOJ10167---Birthday Cake
- 黑马程序员 java 多线程
- EC
- 学习cocos2d-x之路(11)--JumpTo和JumpBy
- EC1