⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updatebook.jsp

📁 此为一个网上购书系统的JSP代码,包括填加图书,定单等功能.
💻 JSP
字号:
<script language="javaScript">
function check()
{
	if(myform.bookname.value=="")
	{
		alert("请输入书名!");
		return false;
	}
	var n=0;
	var price=myform.price.value;
	for(i=0;i<price.length;i++)
	{
		if(price.charAt(i)==".")
		{
			n++;
			if(i==0||i==price.length-1)
			{
				alert("价格请输入数字!");
				return false;
			}
			else if(n>1)
			{
				alert("价格请输入数字!");
				return false;
			}
		}
		else
		{
			if(price.charAt(i)<"0")
			{
				alert("价格请输入数字!");
				return false;
			}
			else if(price.charAt(i)>"9")
			{
				alert("价格请输入数字!");
				return false;
			}
		}
	}		
}
</script>
<link rel="stylesheet" type="text/css" href="style.css"/>
<%@ page contentType="text/html;charset=gb2312" import="java.sql.*"%>
<%@ include file="checkadmin.jsp"%>
<%@ include file="top.jsp"%>
<jsp:useBean id="conn" class="dbBean.DBBean" scope="session"/>
<%
	ResultSet rs=null;
	String bookid="";
	String bookname="";
	String author="";
	String pubdate="";
	String pubhouse="";
	String isbn="";
	String type="";
	String cover="";
	String profile="";
	String price="";
	String updateid="0";
	request.setCharacterEncoding("gb2312");
	if(request.getParameter("updateid")!=null)
		updateid=request.getParameter("updateid");
	String sql="select * from book where bookid="+updateid;
	rs=conn.executeQuery(sql);
	if(rs.next())
	{
		bookid=rs.getString("bookid");
		bookname=rs.getString("bookname");
		author=rs.getString("author");
		pubdate=(rs.getString("pubdate")).substring(0,10);
		pubhouse=rs.getString("pubhouse");
		isbn=rs.getString("isbn");
		type=rs.getString("type");
		cover=rs.getString("cover");
		profile=rs.getString("profile");
		price=rs.getString("price");
	} 
	rs.close();
	conn.close();
%>
<center>
<form name="myform" method="POST" action="dealupdatebook.jsp" onSubmit="return check()">
<table border bordercolor="#0066FF" width="75%"> 
<th background="images/bg04.gif" height="26" colspan="2"> 修改图书信息</th>
  <tr>
	<td>id号:</td>
	<td><%=bookid%><input type="hidden" name="updateid" value="<%=bookid%>"></td>
  <tr>
	<td>书名:</td>
	<td><input type="text" name="bookname" size="65%" value="<%=bookname%>"></td>
  <tr>
	<td>作者:</td>
	<td><input type="text" name="author" size="65%" value="<%=author%>"></td>
  <tr>
	<td>出版日期:</td>
	<td><input type="text" name="pubdate" size="45%" value="<%=pubdate%>">&nbsp;<font color="red">日期格式为:yyyy-mm-dd</font></td>
  <tr>
	<td>出版社:</td>
	<td><input type="text" name="pubhouse" size="65%" value="<%=pubhouse%>"></td>
  <tr>
	<td>ISBN:</td>
	<td><input type="text" name="isbn" size="65%" value="<%=isbn%>"></td>
  <tr>
	<td>类别:</td>
	<td>
	<select name="type">
		<option value="计算机类" <%if(type!=null) if(type.equals("计算机类")) out.print("selected");%>>计算机类</option>
		<option value="财经管理" <%if(type!=null) if(type.equals("财经管理")) out.print("selected");%>>财经管理</option>
		<option value="中外文学" <%if(type!=null) if(type.equals("中外文学")) out.print("selected");%>>中外文学</option>
		<option value="旅游交通" <%if(type!=null) if(type.equals("旅游交通")) out.print("selected");%>>旅游交通</option>
		<option value="政法军事" <%if(type!=null) if(type.equals("政法军事")) out.print("selected");%>>政法军事</option>
		<option value="其它" <%if(type!=null) if(type.equals("其它")) out.print("selected");%>>其它</option>
		</select>
	</td>
  <tr>
	<td>封面:</td>
	<td><input type="text" name="cover" size="65%" value="<%=cover%>"></td>
  <tr>
	<td>内容简介:</td>
	<td><textarea name="profile" rows="10" cols="65%"><%=profile%></textarea></td>
  <tr>
	<td>价格:</td>
	<td><input type="text" name="price" size="65%" value="<%=price%>">&nbsp;元</td>
  <tr>
     <td colspan="2" align="center">
	<input type="submit" value="修改">&nbsp;&nbsp;&nbsp;&nbsp; 
        <input type="reset" value="清空">
     </td>
</table>
</form>
</center>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -