📄 imformation.jsp
字号:
<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="gb2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'imformation.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<style type="text/css">
<!--
body,td,th {
font-family: 仿宋_GB2312;
font-size: 18px;
color: #6600FF;
}
.style1 {
font-size: 24px;
color: #FF0000;
}
-->
</style>
</head>
<body>
<%
String driverName = "com.mysql.jdbc.Driver";
String userName = "root";
String userPasswd = "ptnest";
String url = "jdbc:mysql://127.0.0.1/bookstore?useUnicode=true&characterEncoding=gb2312";
try {
Class.forName(driverName);
} catch (ClassNotFoundException e) {
System.out.print("数据库类没有找到" + e.getMessage());
}
Connection conn = DriverManager.getConnection(url, userName,userPasswd);
Statement stmt = conn.createStatement();
String bookid;
bookid = request.getParameter("BN");
session.setAttribute("id",bookid);
//out.print(bookid);
int bkid=Integer.parseInt(bookid);
String sql = "select *from book where id='" + bkid + "'";
String id = "", name = "", publish_name = "", time = "", type = "", price = "", storenum = "", content = "", commend = "", image = "";
try
{
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
id = rs.getString("id");
name = rs.getString("name");
publish_name = rs.getString("publish_name");
price = rs.getString("price");
storenum = rs.getString("storenum");
time = rs.getString("on_desk_time");
content = rs.getString("content");
commend = rs.getString("commend");
image = rs.getString("image");
type=rs.getString("category");
}
rs.close();
}
catch(Exception e)
{
}
%>
<table border=0 width=800 align=center>
<th height=40 colspan=2 bgcolor=ffc0cb><span class="style1">书的详细信息</span></th>
<tr bgcolor=ffc0cb >
<td width=170 align="right">名称:</td>
<td width=600><%=name%></td>
</tr>
<tr bgcolor=#ffc1cb>
<td height=30 align=right>类型:</td>
<td>
<%
if (type.equals("1"))
out.println("计算机类");
if (type.equals("2"))
out.println("外语类");
if (type.equals("3"))
out.println("数学类");
if (type.equals("4"))
out.println("哲学");
if (type.equals("5"))
out.println("电子技术");
if (type.equals("6"))
out.println("综合");
else
out.println("其他");
%>
</td>
</tr>
<tr bgcolor=ffc2cb>
<td align=right>出版社:</td>
<td><%=publish_name%></td>
</tr>
<tr bgcolor=ffc3cb>
<td align=right>单本价格:</td>
<td><%=price%></td>
</tr>
<tr bgcolor=ffc4cb>
<td align=right>库存:</td>
<td><%=storenum %> </td>
</tr>
<tr bgcolor=ffc5cb>
<td align=right>推荐程度:</td>
<td>
<%
if (commend.equals("1"))
out.println("好");
if(commend.equals("2"))
out.println("较好");
if(commend.equals("3"))
out.println("一般");
if(commend.equals("4"))
out.println("较差");
if(commend.equals("5"))
out.println("差");
else
out.println("");
%>
</td>
</tr>
<tr bgcolor=ffc6cb>
<td align=right>上货时间:</td>
<td><%=time %>
</td>
</tr>
<tr bgcolor=ffc7cb><td align=right>书的描述:</td>
<td><%=content %></td>
</tr>
</table>
<table border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td height="45" align="center" valign="middle"><form action="admin/upload.jsp" method="post" enctype="multipart/form-data" name="form1">
请选择上传的图片
<input type="file" name="file">
<input type="submit" name="Submit" value="上传">
</form></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -