Student.java
package org.lanqiao.entity;
public class Student {
private int stuno;
private String stuname;
private int stuage;
public int getStuno() {
return stuno;
}
public void setStuno(int stuno) {
this.stuno = stuno;
}
public String getStuname() {
return stuname;
}
public void setStuname(String stuname) {
this.stuname = stuname;
}
public int getStuage() {
return stuage;
}
public void setStuage(int stuage) {
this.stuage = stuage;
}
}
mapper.xml
<delete id="deleteStudentByStuno" parameterType="int">
delete from student where stuno = #{stuno}
</delete>
mapper.java
boolean deleteStudentByStuno(int stuno);
ServiceImpl.java
@Override
public boolean deleteStudentByStuno(int stuno) {
return studentMapper.deleteStudentByStuno(stuno);
}
Service.java
boolean deleteStudentByStuno(int stuno)
Controller.java
@RequestMapping("deleteStudentByStuno")
public String deleteStudentByStuno(int stuno){
studentService.deleteStudentByStuno(stuno);
return "allUser";
}
allUser.jsp
<table>
<tr>
<th>学号</th>
<th>姓名</th>
<th>年龄</th>
<th>操作</th>
</tr>
<c:forEach items="${querryAllStudents}" var="stu">
<tr>
<th>${stu.stuno}</th>
<th>${stu.stuname}</th>
<th>${stu.stuage}</th>
<th><a href="controller/deleteStudentByStuno?stuno=${stu.stuno}">删除</a></th>
</tr>
</c:forEach>
</table>