📄 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>搜索结果</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>
<%
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, BN;
bookid = request.getParameter("BN");
int bkid=Integer.parseInt(bookid);
String sql = "select *from book where id=" + bkid ;
String id = "", name = "", publish_name = "", time = "", type = "", price = "", storenum = "", content = "", commend = "", images = "";
try
{
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
id = rs.getString("id");
name = new String(rs.getString("name").getBytes("iso8859_1"),"gb2312");
publish_name =new String(rs.getString("publish_name").getBytes("iso8859_1"),"gb2312");
price = rs.getString("price");
storenum = rs.getString("storenum");
time = rs.getString("on_desk_time");
content = rs.getString("content");
commend = rs.getString("commend");
images = rs.getString("images");
}
rs.close();
}
catch(Exception e)
{
}
%>
<body >
<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("综合");
%>
</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>
<%
if (storenum.equals("0"))
out.println("无");
if (storenum.equals("1"))
out.println("有");
%>
</td>
</tr>
<tr bgcolor=ffc5cb>
<td align=right>精品推荐:</td>
<td>
<%
if (commend.equals("0"))
out.println("是");
if(commend.equals("1"))
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>
<%
if(images==null)
{
%>
<tr bgcolor=ffc8cb>
<td align=right>
书暂无图片</td>
<td height=130 width=320 align=left><img src="img/no.jpg"></td>
<tr>
<%
}
else
{
%>
<tr bgcolor=ffc9cb>
<td align=right>书的图片</td>
<td height=130 width=320 align=left><img src="image/1.jpg" width=70 height=100></td>
<%
}
%>
<input type=button onclick="history.go(-1);return true;" align=center value="返回" method="post">
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -