一、學(xué)習(xí)資源
Java EE企業(yè)級(jí)應(yīng)用開發(fā)教程(Spring+Spring MVC+MyBatis)(第2版)
二、基礎(chǔ)源碼
Spring MVC常用參數(shù)
Spring MVC簡(jiǎn)單應(yīng)用
Spring MVC參數(shù)綁定
三、實(shí)驗(yàn)結(jié)果
3.1 Spring MVC常用參數(shù)
本實(shí)驗(yàn)采用的是本地安裝的tomcat8.5.0版本
(1)創(chuàng)建maven 管理的java web工程
(2)添加本地tomcat
war包
(3)實(shí)驗(yàn)過(guò)程
輸出Hello Word
訪問端口:http://localhost:8080/chapter11/controller01
Spring MVC 常用注解
@Controller和@RequestMapping
實(shí)現(xiàn)自動(dòng)尋找controller
訪問端口:http://localhost:8080/chapter11/execute
@RequestMapping
訪問端口: http://localhost:8080/chapter11/toWelcome
@RequestParam
訪問端口: http://localhost:8080/chapter11/toLogin
@PathVariable
訪問端口: http://localhost:8080/chapter11/claList/1/stuList/2
訪問端口: http://localhost:8080/chapter11/claList/3/stuList/4
@Cookie Value
訪問端口: http://localhost:8080/chapter11/testCookie
@RequestHeader
訪問端口: http://localhost:8080/chapter11/testRequestHeader
3.2 Spring MVC參數(shù)綁定
本實(shí)驗(yàn)使用的為tomcat7.0版本
在源碼文件的pom.xml中有配置插件
3.2.1 簡(jiǎn)單數(shù)據(jù)類型綁定
默認(rèn)數(shù)據(jù)類型
訪問端口:http://localhost:8080/findById
簡(jiǎn)單數(shù)據(jù)類型
綁定POJO類型
自定義數(shù)據(jù)類型
3.2.2 復(fù)雜數(shù)據(jù)類型綁定
(知道一點(diǎn)),此處前端值向后端傳遞沒有成功
數(shù)組類型
集合類型
四、實(shí)驗(yàn)小結(jié)
本實(shí)驗(yàn)需要熟練使用maven和Tomcat,以及理解spring MVC參數(shù)使用;設(shè)計(jì)javaweb知識(shí),需要回顧前后端值傳遞過(guò)程。文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-441454.html
歡迎大家在評(píng)論區(qū)討論交流,有時(shí)間就回。。。。
看到這里記得點(diǎn)贊+關(guān)注^^文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-441454.html
到了這里,關(guān)于Spring MVC:常用參數(shù)(注解)的使用和參數(shù)綁定的驗(yàn)證的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!