@RequestMapping(value="/Test/{id}")
public void Test(@PathVariable Integer id){
.............
}
在页面表单的action中,写controller中对应的方法名
TestController.java
@RequestMapping(value="/{methodName}")
public String TZ(@PathVariable String methodName){
return methodName;
}
@Controller
public class ItemController {
@Autowired
private ItemService itemService;
@RequestMapping("/item/{itemId}")
@ResponseBody
public TbItem geItemById(@PathVariable Long itemId){
TbItem tbItem = itemService.getItemById(itemId);
return tbItem;
}