-
springMvc参数传递的方法
- package cn.edu.hj.controller;
- import java.util.Map;
- import javax.servlet.http.HttpServletRequest;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.Model;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
-
- @Controller
- public class HelloController {
-
- @RequestMapping(value = "/hello.htm")
- public String hello(int id){
- System.out.println("hello action:"+id);
- return "redirect:/index.jsp";
- }
-
-
- @RequestMapping(value = "/hello1.htm")
- public String hello(int id,Map<String,Object> map){
- System.out.println("hello1 action:"+id);
- map.put("name", "huangjie");
- return "hello";
- }
-
-
- @RequestMapping(value = "/hello2.htm")
- public String hello2(int id,Model model){
- System.out.println("hello2 action:"+id);
- model.addAttribute("name", "huangjie");
-
- model.addAttribute("ok");
- return "hello";
- }
-
-
- @RequestMapping(value = "/hello3.htm")
- public String hello3(HttpServletRequest request){
- String id = request.getParameter("id");
- System.out.println("hello3 action:"+id);
- return "hello";
- }
- }
-
相关阅读:
linux下挂载硬盘出错的解决方法
linux下解压缩文件中文乱码问题的解决
VLC播放器的快捷键(shutcut)
PGSQL 日期时间的比较
PGSQL 字符串作为查询参数的处理
pqsql 防注入
js字符数组转化为数字数组
js去除字符串的前后空白
使用gravatar生成头像
js删除数组的某个元素
-
原文地址:https://www.cnblogs.com/zhaoxinshanwei/p/5785607.html
Copyright © 2020-2023
润新知