实现修改消费账单
1.main_left.jsp中该部分,调用Servlet中的list方法
2.Servlet中的list方法,调用Dao层的list方法,跳转到list.jsp页面
3.Dao层的list方法
4.list.jsp,提交到Servlet的getcoursebyid方法
pageEncoding="UTF-8"%>
Insert title here.a{
font-size: 20px;
}
Object message = request.getAttribute("message");
if(message!=null && !"".equals(message)){
%>
alert("");
id | 消费名称 | 消费金额 | 消费日期 | |
${item.id} | ${item.name} | ${item.money} | ${item.date} | 修改 |
5.Servlet的getcoursebyid方法,调用Dao层的getCourseById方法,跳转到detail2.jsp
6.Dao层的getCourseById方法
7.detail2.jsp,调用Servlet的update方法,
pageEncoding="UTF-8"%>
Insert title here.a{
margin-top: 20px;
}
.b{
font-size: 20px;
width: 160px;
color: white;
background-color: greenyellow;
}
Object message = request.getAttribute("message");
if(message!=null && !"".equals(message)){
%>
alert("");
消费名称:
消费金额:
消费日期:
修 改
function check() {
var name=document.getElementById("name");
var money=document.getElementById("money");
var date=document.getElementById("date");
if(name.value==‘‘){
alert(‘消费名称为空‘);
name.focus();
return false;
}
if(money.value==‘‘){
alert(‘消费金额为空‘);
money.focus();
return false;
}
if(date.value==‘‘){
alert(‘消费日期为空‘);
date.focus();
return false;
}
}
8.Servlet的update方法,调用Dao层的update方法
9.Dao层的update方法,实现与数据库的操作,添加成功
总结:
Servlet?method=list --> Dao?method=list --> list.jsp --> Servlet?method=getcoursebyid --> Dao?method=getCourseById --> detail2.jsp --> Servlet?method=update --> Dao?method=update