1.JSP页面上书写样式
function del(id){
window.location.href="${pageContext.request.contextPath}/student/delete/"+id;}
2.在controller中取得url中包含的id信息
@Controller
@RequestMapping("student")
@RequestMapping(value="/delete/{id}" ,method = RequestMethod.GET)
public String studentDelete(Model m,HttpSession session,@PathVariable String id) {
//方法体
}
总结:使用的诀窍是使用@PathVariable标签。