SpringMVC程序简单实例
来源:
中文源码网 浏览:248 次 日期:2024-04-30 18:09:37
【下载文档: SpringMVC程序简单实例.txt 】
SpringMVC程序简单实例
StringMVC程序简单实例
第一步:导入jar包
第二步,在WEB-INF文件夹下创建spring-servlet.xml文件。
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:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
class="org.springframework.web.multipart.commons.CommonsMultipartResolver"
p:defaultEncoding="utf-8" />
第三步:在web.xml文件配置springmvc。
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">
springmvc1
index.html
index.htm
index.jsp
default.html
default.htm
default.jsp
characterEncodingFilter
org.springframework.web.filter.CharacterEncodingFilter
encoding
UTF-8
forceEncoding
true
Spring MVC Dispatcher Servlet
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
/WEB-INF/spring-servlet.xml
1
Spring MVC Dispatcher Servlet
/
第四步:创建一个控制器。
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!