jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<body>
<h2>Hello World!h2>
<a href="users/add5/1/zhangsan">添加5a>
<a href="users/aa/add6">添加6a>
body>
html>
java
package com.test.controller;
import com.test.pojo.Users;
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.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
@Controller
@RequestMapping("/users")
public class UsersController {
@RequestMapping("/add5/{id}/{name}")
public String add5(@PathVariable(value="id") int id,@PathVariable(value="name") String name)
{
System.out.println(id);
System.out.println(name);
return "success";
}
@RequestMapping("/**/?dd6")
public String add6()
{
return "success";
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43