1 / 19
文档名称:

springmvc教程.doc

格式:doc   大小:754KB   页数:19页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

springmvc教程.doc

上传人:63229029 2017/5/17 文件大小:754 KB

下载得到文件列表

springmvc教程.doc

文档介绍

文档介绍:1 、 spring mvc 教程 编写目的鉴于现在有很多公司在使用 Spring MVC ,为了大家进入公司后能很快上手,特编写此文档。 教程说明 S pring 采用 J dk 采用 , 版本会出现一个问题,暂时还木找到解决方案。 2 、入门案例 新建一个 Dynamic web project 添加 jar 包 配置前端控制器及***在 配置如下内容: < context-param >< param-name > contextConfigLocation </ param-name > < param-value > /WEB-INF/ helloworld - </ param-value > </ context-param >< listener >< listener-class > </ list ener-class > </ listener >< servlet >< servlet-name > helloworld </ servlet-name > < servlet-class > </ servlet-c lass >< load-on-startup >1 </ load-on-startup > </ servlet >< servlet-mapping >< servlet-name > helloworld </ servlet-name > < url-pattern >/ </ url-pattern > </ servlet-mapping > 在 WEB-INF 下创建 spring 配置文件 helloworld - <? xml version = "" encoding = "UTF-8" ?> < beans xmlns = "ema/beans" xmlns:xsi = "1/XMLSchema-instance" xmlns:context = "ema/context" xsi:schemaLocation = "ema/beans ema/beans/spring-beans- ema/context ema/context/spring-context-" > < ponent-scan base-package = "" ></ ponent-scan > < bean id = "viewResolver" class = "" > < property name = "prefix" > < value > /WEB-INF/pages/ </ value > </ property >< property name = "suffix" > < value >. jsp </ value > </ property > </ bean > </ beans > ; .; .; .; .; ***@Controller ***@RequestMapping (value={ "/helloworld" }) public class MyController { ***@RequestMapping (method=RequestMethod. GET ) public String helloWorld(ModelMap modelMap ){ modelMap .addAttribute( "message1" , "oraclewdp" ); return "mypage1" ; }} 创建视图在 WEB-INF 下建立文件夹 pages, 然后创建 在 webcontent 下新建