发表于: 2019-11-21 22:30:40
1 1229
今天完成的:
修改了增删查改的
接口文档格式
增加
post /springmvc_01/student
删除
delete /springmvc_01/student/{id}
修改
put /springmvc_01/student/{id}
查询
get /springmvc_01/student{id}
对应的controller层
@RequestMapping(path ="/{id}",method = {RequestMethod.GET})
public String searchById(@PathVariable("id") int id){
studentDao.searchById(id);
return "get";
}
//根据学生id,更改学生职业
@RequestMapping(path = "/{id}",method = {RequestMethod.PUT})
public String updateById(Type type,int id){
studentDao.updateById(type,id);
return "put";
}
//根据学生id删除
@RequestMapping(path = "/{id}",method = {RequestMethod.DELETE})
public String deleteById(int id){
studentDao.deleteById(id);
return "delete";
}
//添加一个学生
@RequestMapping(method = {RequestMethod.POST})
public String insertStudent(Student student){
studentDao.insertStudent(student);
return "post";
但这样改的话
index.jsp文件里 跳转链接都想用了
也不知道改如何跳转
<html>
<head>
</head>
<body>
<a href="Student">增加</a>
<a href="Student/{id}">删除</a>
<a href="Student/{id}">查询</a>
<a href="Student/{id}">修改</a>
</body></html>
因为每个都相同
看着也是有点懵
对任务的一些要求 感觉还是一头雾水
明天计划的事情:
继续学习
推动任务
评论