📄 delpet.jsp~23~
字号:
<%@page contentType="text/html; charset=GB2312" import="java.sql.*,com.pet.util.*,com.pet.pets.model.DAO.impl.Petimpl,com.pet.pets.model.DAO.PetDao;"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<title>删改宠物</title>
<script type="text/javascript" language="javascript">
function sel(){
if(document.form1.pname.value == "moren"){
return;
}else{
document.res.pid.value =document.form1.pid.value;
document.res.submit();
}
}
function aa(){
var name = document.form1.pname.value;
if( name.length==0){
alert("请选择宠物姓名!");
return;
}else{
document.del.submit();
}
}
function bb(){
var name = document.form1.pname.value;
if( name.length==0){
alert("请选择宠物姓名!");
return false;
}
}
</script>
</head>
<jsp:useBean id="petBean" scope="session" class="com.pet.pets.model.DTO.PetBean"/>
<jsp:useBean id="userBean" scope="session" class="com.pet.user.model.DTO.UserBean"/>
<body bgcolor="#ffffff">
<h4 align="center">删除或修改宠物信息</h4>
<form name="del" action="/WebModule/delpetservlet" method="POST">
<input type="hidden" name="pid" value="${petBean.PID}"/>
</form>
<form name="res" action="/WebModule/selservlet" method="POST">
<input type="hidden" name="pid"/>
</form>
<form name="form1" method="post" action="/WebModule/updateservlet" onsubmit="return bb()">
<input type="hidden" name="pid" value="" />
<table width="50%" border="0" align="center">
<tr>
<td width="15%"> </td>
<td width="35%"> </td>
</tr>
<tr>
<td> </td>
<td>
<select name="pid" onchange="sel()">
<option value="moren">请选择您的宠物</option>
<%
DBCon db = new DBCon();
ResultSet rs = null;
try {
rs = db.querySQL("select PID,Pname from pets where PUID=" + userBean.getUID());
while (rs.next()) {
%>
<option value="<%=rs.getInt(1)%>"><%=rs.getString(2)%> </option>
<%
}
db.closeConn();
} catch (Exception ex) {
ex.printStackTrace();
}
%>
</select>
</td>
</tr>
<tr>
<td>宠物名字:</td>
<td>
<input type="text" name="pname" value="${petBean.pname}"/>
</td>
</tr>
<tr>
<td>宠物性别:</td>
<td>
<c:choose>
<c:when test="${petBean.psex==0}">雄性</c:when>
<c:when test="${petBean.psex==1}">雌性</c:when>
</c:choose>
<select name="Psex">
<option value="0">雄</option>
<option value="1">雌</option>
</select>
</td>
</tr>
<tr>
<td>宠物类型:</td>
<td>
<%PetDao petdao = new Petimpl(); %>
<%=petdao.gettype(petBean.getPtype())%> <select name="Ptype">
<%
try {
rs = db.querySQL("select * from types");
while (rs.next()) {
%>
<option value="<%=rs.getInt(1)%>"><%=rs.getString(2)%> </option>
<%
}
db.closeConn();
} catch (Exception ex) {
ex.printStackTrace();
}
%>
</select>
</td>
</tr>
<tr>
<td>宠物年龄:</td>
<td>${petBean.page} 岁
<select name="Page">
<option value="0-1">0~1岁</option>
<option value="1-2">1~2岁</option>
<option value="2-5">2~5岁</option>
<option value="5-10">5~10岁</option>
<option value="10岁以上">10岁以上</option>
</select>
</td>
</tr>
<tr>
<td>宠物描述:</td>
<td>
<textarea name="Premark" cols="20" rows="4">${petBean.premark} </textarea>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="删除" onclick="aa()"/>
<input type="submit" value="修改" />
</td>
</tr>
</table>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -