qq_51390382 2021-06-17 19:56 采纳率: 50%
浏览 52

ssm框架 删除操作 一直报404

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>
  • 写回答

1条回答 默认 最新

  • li.siyuan 2021-06-17 22:05
    关注
    /controller/deleteStudentByStuno?

     你在你的地址前边加个斜杠 试一下

    评论

报告相同问题?

悬赏问题

  • ¥15 RCS plot 包内置数据集使用时报错,如何解决?
  • ¥50 python for 循环优化数据优化
  • ¥15 keil+mspm0g3507+二维总线舵机
  • ¥15 如何用wireshark分析找出url接口和param参数
  • ¥15 有谁知道这是阿里云那个应用的域名吗,怎么调用?
  • ¥30 正则表达式的一些问题
  • ¥15 C#如何使用ClosedXML库搭配别的库实现:将指定Excel区域导出为图片(例如A1:AO50)
  • ¥15 虚拟机只能接收不能发送
  • ¥15 为什么echarts极坐标柱形图的图形显示的特别小呢
  • ¥20 网络科学导论,网络同步与控制