).trim());
if(delId==0){
out.print(showDialog("你要修改餐馆的记录不存在!"));
return;
}
file://标志显示记录存在
boolean recordExist=false;
//校验数据的唯一性
for(int i=0;i<restaurants.getLength();i++){
Element restaurant=(Element) restaurants.item(i);
if(Integer.parseInt(restaurant.getAttributeNode("id").getNodeValue())==delId){
recordExist=true;
intI=i;
}
}
if(!recordExist){
out.print(showDialog("你要删除餐馆的记录不存在!"));
return;
}else{
//进行记录删除的操作
try{
Node delNode=(Node)restaurants.item(intI);
doc.getElementsByTagName("restaurants").item(0).removeChild(delNode);
//调用bean 写入相应的xml文件
writeXmlBean.writeXml(doc,"webapps/canyin/data/restaurants.xml");
response.sendRedirect(request.getRequestURI());
return;
}catch(Exception e){}
}
}
}
//由外部传入参数决定页面相应的处理状态
if (strAct==null){
strOperation="show";
}else{
if (strAct.equals("modi")){
strOperation="modi";
intId=Integer.parseInt(request.getParameter("recordId"));
}else{
if(strAct.equals("addnew")){
strOperation="addnew";
}else{
strOperation="show";
}
}
}
//如果为空记录,则变更页面状态为“新增”
if (restaurants.getLength()==0){
strOperation="addnew";
}
%>
<html>
<head>
<title>oddWorld 餐饮系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" href="../../include/itsp.css" type="text/css">
</head>
<body >
<div align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="22">
<tr>
<td width="1"><img src="../../images/top_r1.GIF" width="62" height="22"></td>
<td width=150 align="center"> 餐饮系统管理--餐馆管理</td>
<td><img src="../../images/top_r2.GIF" width="294" height="22"></td>
<td width=100 align="center"><a href="/index.html">[ 退出系统 ]</a></td>
</tr>
</table>
<br>
<br>
<table bgcolor="#999999" align=center border=0 cellpadding=1 cellspacing=1
width="90%">
<tbody>
<tr bgcolor="#efefef" align="center" valign="middle">
<td class=ttTable height=30 width="20"> </td>
<td class=ttTable height=30 width="0">餐馆名称</td>
<td class=ttTable height=30 width="0">餐馆电话</td>
<td class=ttTable height=30 width="0">
<div align="center">餐馆地址</div>
</td>
<td class=ttTable height=30 width="30">
<div align="center">修改</div>
</td>
<td class=ttTable height=30 width="30">
<div align="center">删除</div>
</td>
</tr>
<%
for(int i=0;i<restaurants.getLength();i++)
{
Element restaurant=(Element) restaurants.item(i);
if (strOperation=="modi" && Integer.parseInt(restaurant.getAttributeNode("id").getNodeValue())==intId){
%>
<%//显示修改的格式%>
<tr align="center" bgcolor="#ffffff" valign="middle">
<form name=dataform action="<%=request.getRequestURI()%>?act=modiDo" method="post" onSubmit='return checkform(this);' >
<td class=tdsmall height=25 width="20">
<input type="hidden" name="recordId" value="<%=restaurant.getAttributeNode("id").getNodeValue()%>">
<%=(i+1)%></td>
<td class=tdsmall height=25>
<input name="name" class=stedit
style="HEIGHT: 22px; WIDTH: 150px" value="<%if(restaurant.getElementsByTagName("name").item(0).hasChildNodes()){
out.print(restaurant.getElementsByTagName("name").item(0).getFirstChild().getNodeValue());
}%>
" maxlength="40" >
</td>
<td class=tdsmall height=25>
<input name="phone" class=stedit
style="HEIGHT: 22px; WIDTH: 100px" value="<%if(restaurant.getElementsByTagName("phone").item(0).hasChildNodes()){
out.print(restaurant.getElementsByTagName("phone").item(0).getFirstChild().getNodeValue());
}%>" maxlength="20" >
</td>
<td class=tdsmall height=25>
<input name="address" class=stedit
style="HEIGHT: 22px; WIDTH: 200px" value="<%
if(restaurant.getElementsByTagName("address").item(0).hasChildNodes()){
out.print(restaurant.getElementsByTagName("address").item(0).getFirstChild().getNodeValue());
}%>" maxlength="100" >
</td>
<td class=tdsmall height=25 width="25"><a href="javascript:if (checkform()==false);"><img border=0
height=15 src="../../images/editok.gif" width=15></a></td>
<td class=tdsmall height=25 width="25"> </td>
</form>
</tr>
<% }else{
//显示正常的格式 %>
<tr align="center" bgcolor="#ffffff" valign="middle">
<td class=tdsmall height=25 width="20"><%=(i+1)%></td>
<td class=tdsmall height=25 width="0"><%if(restaurant.getElementsByTagName("name").item(0).hasChildNodes()){
out.print(restaurant.getElementsByTagName("name").item(0).getFirstChild().getNodeValue());
}%>
</td>
<td class=tdsmall height=25 width="0"><%if(restaurant.getElementsByTagName("phone").item(0).hasChildNodes(
if(delId==0){
out.print(showDialog("你要修改餐馆的记录不存在!"));
return;
}
file://标志显示记录存在
boolean recordExist=false;
//校验数据的唯一性
for(int i=0;i<restaurants.getLength();i++){
Element restaurant=(Element) restaurants.item(i);
if(Integer.parseInt(restaurant.getAttributeNode("id").getNodeValue())==delId){
recordExist=true;
intI=i;
}
}
if(!recordExist){
out.print(showDialog("你要删除餐馆的记录不存在!"));
return;
}else{
//进行记录删除的操作
try{
Node delNode=(Node)restaurants.item(intI);
doc.getElementsByTagName("restaurants").item(0).removeChild(delNode);
//调用bean 写入相应的xml文件
writeXmlBean.writeXml(doc,"webapps/canyin/data/restaurants.xml");
response.sendRedirect(request.getRequestURI());
return;
}catch(Exception e){}
}
}
}
//由外部传入参数决定页面相应的处理状态
if (strAct==null){
strOperation="show";
}else{
if (strAct.equals("modi")){
strOperation="modi";
intId=Integer.parseInt(request.getParameter("recordId"));
}else{
if(strAct.equals("addnew")){
strOperation="addnew";
}else{
strOperation="show";
}
}
}
//如果为空记录,则变更页面状态为“新增”
if (restaurants.getLength()==0){
strOperation="addnew";
}
%>
<html>
<head>
<title>oddWorld 餐饮系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" href="../../include/itsp.css" type="text/css">
</head>
<body >
<div align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="22">
<tr>
<td width="1"><img src="../../images/top_r1.GIF" width="62" height="22"></td>
<td width=150 align="center"> 餐饮系统管理--餐馆管理</td>
<td><img src="../../images/top_r2.GIF" width="294" height="22"></td>
<td width=100 align="center"><a href="/index.html">[ 退出系统 ]</a></td>
</tr>
</table>
<br>
<br>
<table bgcolor="#999999" align=center border=0 cellpadding=1 cellspacing=1
width="90%">
<tbody>
<tr bgcolor="#efefef" align="center" valign="middle">
<td class=ttTable height=30 width="20"> </td>
<td class=ttTable height=30 width="0">餐馆名称</td>
<td class=ttTable height=30 width="0">餐馆电话</td>
<td class=ttTable height=30 width="0">
<div align="center">餐馆地址</div>
</td>
<td class=ttTable height=30 width="30">
<div align="center">修改</div>
</td>
<td class=ttTable height=30 width="30">
<div align="center">删除</div>
</td>
</tr>
<%
for(int i=0;i<restaurants.getLength();i++)
{
Element restaurant=(Element) restaurants.item(i);
if (strOperation=="modi" && Integer.parseInt(restaurant.getAttributeNode("id").getNodeValue())==intId){
%>
<%//显示修改的格式%>
<tr align="center" bgcolor="#ffffff" valign="middle">
<form name=dataform action="<%=request.getRequestURI()%>?act=modiDo" method="post" onSubmit='return checkform(this);' >
<td class=tdsmall height=25 width="20">
<input type="hidden" name="recordId" value="<%=restaurant.getAttributeNode("id").getNodeValue()%>">
<%=(i+1)%></td>
<td class=tdsmall height=25>
<input name="name" class=stedit
style="HEIGHT: 22px; WIDTH: 150px" value="<%if(restaurant.getElementsByTagName("name").item(0).hasChildNodes()){
out.print(restaurant.getElementsByTagName("name").item(0).getFirstChild().getNodeValue());
}%>
" maxlength="40" >
</td>
<td class=tdsmall height=25>
<input name="phone" class=stedit
style="HEIGHT: 22px; WIDTH: 100px" value="<%if(restaurant.getElementsByTagName("phone").item(0).hasChildNodes()){
out.print(restaurant.getElementsByTagName("phone").item(0).getFirstChild().getNodeValue());
}%>" maxlength="20" >
</td>
<td class=tdsmall height=25>
<input name="address" class=stedit
style="HEIGHT: 22px; WIDTH: 200px" value="<%
if(restaurant.getElementsByTagName("address").item(0).hasChildNodes()){
out.print(restaurant.getElementsByTagName("address").item(0).getFirstChild().getNodeValue());
}%>" maxlength="100" >
</td>
<td class=tdsmall height=25 width="25"><a href="javascript:if (checkform()==false);"><img border=0
height=15 src="../../images/editok.gif" width=15></a></td>
<td class=tdsmall height=25 width="25"> </td>
</form>
</tr>
<% }else{
//显示正常的格式 %>
<tr align="center" bgcolor="#ffffff" valign="middle">
<td class=tdsmall height=25 width="20"><%=(i+1)%></td>
<td class=tdsmall height=25 width="0"><%if(restaurant.getElementsByTagName("name").item(0).hasChildNodes()){
out.print(restaurant.getElementsByTagName("name").item(0).getFirstChild().getNodeValue());
}%>
</td>
<td class=tdsmall height=25 width="0"><%if(restaurant.getElementsByTagName("phone").item(0).hasChildNodes(
上一页 [1] [2] [3] [4] [5] [6] 下一页