package com.demo.web.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping(value = "/helloworld")
public class HelloWorldController {
@RequestMapping(value="/*", method = {RequestMethod.GET})
public ModelAndView urlTest(){
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("urltest");
return modelAndView;
}
@RequestMapping(value={"/index","/hello"})
public ModelAndView index(){
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("message", "Hello World!");
modelAndView.setViewName("index");
return modelAndView;
}
@RequestMapping(value="/detail/{id}", method = {RequestMethod.GET})
public ModelAndView getDetail(@PathVariable(value="id") Integer id){
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("id", id);
modelAndView.setViewName("detail");
return modelAndView;
}
@RequestMapping(value="/reg/{name:\\w+}-{age:\\d+}", method = {RequestMethod.GET})
public ModelAndView regUrlTest(@PathVariable(value="name") String name, @PathVariable(value="age") Integer age){
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("name", name);
modelAndView.addObject("age", age);
modelAndView.setViewName("regurltest");
return modelAndView;
}
@RequestMapping(value="/paramstest", params="example!=AAA", method = {RequestMethod.GET})
public ModelAndView paramsTest(){
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("paramstest");
return modelAndView;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
SpringMVC入门很简单之URL映射规则.zip (72个子文件)
WebContent
WEB-INF
views
paramstest.jsp 352B
urltest.jsp 349B
index.jsp 351B
regurltest.jsp 355B
detail.jsp 346B
lib
spring-expression-3.2.5.RELEASE-sources.jar 157KB
spring-instrument-3.2.5.RELEASE-javadoc.jar 32KB
spring-tx-3.2.5.RELEASE.jar 237KB
spring-oxm-3.2.5.RELEASE.jar 73KB
spring-orm-3.2.5.RELEASE-javadoc.jar 746KB
spring-instrument-tomcat-3.2.5.RELEASE-sources.jar 5KB
spring-jms-3.2.5.RELEASE-sources.jar 178KB
spring-beans-3.2.5.RELEASE-javadoc.jar 1.24MB
spring-aspects-3.2.5.RELEASE-sources.jar 30KB
spring-expression-3.2.5.RELEASE-javadoc.jar 399KB
spring-aspects-3.2.5.RELEASE.jar 50KB
spring-webmvc-3.2.5.RELEASE.jar 622KB
spring-jdbc-3.2.5.RELEASE.jar 396KB
spring-beans-3.2.5.RELEASE-sources.jar 537KB
spring-web-3.2.5.RELEASE-sources.jar 617KB
spring-webmvc-portlet-3.2.5.RELEASE.jar 184KB
spring-expression-3.2.5.RELEASE.jar 192KB
spring-build-src-3.2.5.RELEASE.jar 71KB
spring-webmvc-portlet-3.2.5.RELEASE-sources.jar 190KB
spring-test-3.2.5.RELEASE.jar 447KB
spring-oxm-3.2.5.RELEASE-javadoc.jar 179KB
jstl.jar 20KB
spring-context-3.2.5.RELEASE-sources.jar 852KB
spring-aspects-3.2.5.RELEASE-javadoc.jar 70KB
spring-oxm-3.2.5.RELEASE-sources.jar 58KB
spring-jms-3.2.5.RELEASE.jar 201KB
spring-context-3.2.5.RELEASE-javadoc.jar 2.06MB
spring-aop-3.2.5.RELEASE.jar 328KB
spring-webmvc-portlet-3.2.5.RELEASE-javadoc.jar 475KB
spring-instrument-tomcat-3.2.5.RELEASE-javadoc.jar 45KB
spring-jdbc-3.2.5.RELEASE-javadoc.jar 1.04MB
spring-struts-3.2.5.RELEASE-javadoc.jar 115KB
spring-test-3.2.5.RELEASE-javadoc.jar 884KB
spring-orm-3.2.5.RELEASE.jar 376KB
spring-context-support-3.2.5.RELEASE.jar 125KB
spring-webmvc-3.2.5.RELEASE-sources.jar 633KB
spring-core-3.2.5.RELEASE-javadoc.jar 1MB
spring-core-3.2.5.RELEASE.jar 850KB
spring-core-3.2.5.RELEASE-sources.jar 466KB
spring-context-support-3.2.5.RELEASE-sources.jar 131KB
spring-tx-3.2.5.RELEASE-javadoc.jar 768KB
spring-webmvc-3.2.5.RELEASE-javadoc.jar 1.49MB
spring-instrument-tomcat-3.2.5.RELEASE.jar 10KB
spring-context-3.2.5.RELEASE.jar 845KB
spring-web-3.2.5.RELEASE.jar 613KB
spring-test-3.2.5.RELEASE-sources.jar 356KB
spring-instrument-3.2.5.RELEASE-sources.jar 2KB
spring-struts-3.2.5.RELEASE-sources.jar 40KB
spring-web-3.2.5.RELEASE-javadoc.jar 1.52MB
spring-aop-3.2.5.RELEASE-sources.jar 319KB
commons-logging-1.1.3.jar 61KB
spring-jms-3.2.5.RELEASE-javadoc.jar 456KB
spring-beans-3.2.5.RELEASE.jar 596KB
standard.jar 384KB
spring-context-support-3.2.5.RELEASE-javadoc.jar 362KB
spring-tx-3.2.5.RELEASE-sources.jar 273KB
spring-struts-3.2.5.RELEASE.jar 35KB
spring-instrument-3.2.5.RELEASE.jar 7KB
spring-orm-3.2.5.RELEASE-sources.jar 331KB
spring-jdbc-3.2.5.RELEASE-sources.jar 415KB
spring-aop-3.2.5.RELEASE-javadoc.jar 768KB
web.xml 1KB
META-INF
MANIFEST.MF 39B
src
web
com
demo
web
controllers
HelloWorldController.java 2KB
build
classes
springservlet-config.xml 2KB
com
demo
web
controllers
HelloWorldController.class 2KB
resources
springservlet-config.xml 2KB
共 72 条
- 1
资源评论
miracle_yao
- 粉丝: 6
- 资源: 31
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Screenshot_20240427_031602.jpg
- 网页PDF_2024年04月26日 23-46-14_QQ浏览器网页保存_QQ浏览器转格式(6).docx
- 直接插入排序,冒泡排序,直接选择排序.zip
- 在排序2的基础上,再次对快排进行优化,其次增加快排非递归,归并排序,归并排序非递归版.zip
- 实现了7种排序算法.三种复杂度排序.三种nlogn复杂度排序(堆排序,归并排序,快速排序)一种线性复杂度的排序.zip
- 冒泡排序 直接选择排序 直接插入排序 随机快速排序 归并排序 堆排序.zip
- 课设-内部排序算法比较 包括冒泡排序、直接插入排序、简单选择排序、快速排序、希尔排序、归并排序和堆排序.zip
- Python排序算法.zip
- C语言实现直接插入排序、希尔排序、选择排序、冒泡排序、堆排序、快速排序、归并排序、计数排序,并带图详解.zip
- 常用工具集参考用于图像等数据处理
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功