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

📄 detailview.jsp

📁 面向对象软件工程案例
💻 JSP
字号:
<%-- 
     ***************文件名  : detailView.jsp 
     ***************功能    : 图书详细信息查看
     ***************作者    : 马俊
     ***************接口参数: bookID(要查看图书的ID号)
     ***************实现过程: 

--%>






<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<HTML><HEAD><TITLE>图书详细信息</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<SCRIPT language=JavaScript type=text/JavaScript>
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</SCRIPT>

<SCRIPT src="images/alt.js"></SCRIPT>
<LINK href="images/default.css" type=text/css 
rel=stylesheet>
<META content="Microsoft FrontPage 6.0" name=GENERATOR></HEAD>
<BODY background=images/crossbig.gif
onmouseover="window.status='【欢迎你光临我们的网站】如果您喜欢本站,别忘了把本站介绍给您的好友哦!:)';return true" 
leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<SCRIPT language=JavaScript>
<!--
function checkss()
{
   if(checkspace(document.searchform.searchkey.value !='请输入关键字'))  {
	document.searchform.searchkey.focus();
	alert("请输入查询关键字!");
	return false;
  }
  if(checkspace(document.searchform.searchkey.value))  {
	document.searchform.searchkey.focus();
	alert("请输入查询关键字!");
	return false;
  }
   document.searchform.submit();
}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
//-->
</SCRIPT>

<%  
   //获得登录名,若为空则表示未登录
   String logName=(String) session.getValue("logName");
%>

<TABLE cellSpacing=0 cellPadding=0 width=776 align=center border=0>
  <TBODY>
  <TR>
    <TD width=771 height=14>
      <object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="770" height="120">
		<param name="movie" value="images/headnew.swf">
		<param name="quality" value="High">
		<embed src="images/headnew.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="770" height="120"></object>
	</TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=776 align=center 
background="images/INDEX_r2_c1.jpg" border=0>
  <TBODY>
  <TR>
    <TD width=160 height=25>&nbsp;&nbsp;                        
    <SCRIPT language=JavaScript type=text/JavaScript>    
today=new Date();
 function initArray(){
   this.length=initArray.arguments.length
   for(var i=0;i<this.length;i++)
   this[i+1]=initArray.arguments[i]  }
   var d=new initArray(
     "星期日",
     "星期一",
     "星期二",
     "星期三",
     "星期四",
     "星期五",
     "星期六");
document.write(
     "<font color=#ffffff>"+
     today.getYear()+"年"+
     (today.getMonth()+1)+"月"+
     today.getDate()+"日   "+
     d[today.getDay()+1]+
     "</font>"); 
</SCRIPT>
</TD>


<%  if(logName==null)
    {

%>
    <TD width=616><IMG height=10 src="images/b.gif" 
      width=10 align=absMiddle><FONT color=#333333><font color="#FFFFFF"> </font> <A 
            class=a1 href="index.jsp" target=_top>
<%  }
    else
    {
%>   
    <TD width=616><IMG height=10 src="images/b.gif" 
      width=10 align=absMiddle><FONT color=#333333><font color="#FFFFFF"> </font> <A 
            class=a1 href="main.jsp" target=_top>
<%  }
%> 
	<font color="#FFFFFF">首 页</font></A></FONT><FONT color=#333333><font color="#FFFFFF"> | </font>
	 <A class=a1 href="userPannel.jsp" target=_top>                             
            <font color="#FFFFFF">个人信息面板</font></FONT><FONT color=#333333><font color="#FFFFFF"> | </font></FONT></a>
         <A class=a1 href="newList.jsp?pubDate=2001/2/4&ToPage=1"  target=_top>
            <font color="#FFFFFF">新品上架</font></A><FONT color=#FFFFFF> | </FONT> 
         <A class=a1 href="sortList.jsp?sort=计算机硬件&ToPage=1" target=_top>
	    <font color="#FFFFFF">图书分类</font></A><FONT color=#FFFFFF> |</FONT>
         <A class=a1 href="commendList.jsp?limitNum=10&ToPage=1"  target=_top>
            <font color="#FFFFFF">精品推荐</font></A><FONT color=#FFFFFF> | </FONT> 	 
         <A class=a1 href="topList.jsp?limitNum=10&ToPage=1" target=_top>
	    <font color="#FFFFFF">排行榜</font></A><FONT color=#FFFFFF> | </FONT>                               
	 <a class="a1" target="_top" href="help.jsp">
	    <font color="#FFFFFF">在线帮助</font></a><FONT color=#FFFFFF>|</FONT></FONT>
	 <FONT color=#ffffff>&nbsp;&nbsp;</FONT>
<%  if(logName==null) 
    {
%>	 
	 <FONT color=#FF0000>您还没有登录!!!</FONT>
<%  }
    else
    {
%>	 
	 <FONT color=#FF0000>当前登录用户:<%=logName%></FONT>
<%
    }
%>	 
	 <DIV></DIV></TD></TR></TBODY></TABLE>  
<TABLE id=Table1 cellSpacing=0 cellPadding=0 width=776 align=center border=0>
  <TBODY>
  <TR>
    <FORM id=Search name=searchform 
    action=searchResult.jsp?ToPage=1  method=post>
    <TD bgColor=#cce3e7 height=26>
      <DIV align=center> </DIV>
      <DIV align=center><IMG height=16 
      src="images/search.gif" width=64 align=absMiddle> &nbsp;                  
      <INPUT onfocus="this.value=''" value=请输入关键字 name=searchkey size="20">
        <SELECT id=action name=condition>                 
          <OPTION value=1 selected>书 名</OPTION> 
          <OPTION value=2>作 者</OPTION> 
          <OPTION value=3>出版社</OPTION> 
          <OPTION value=4>ISBN</OPTION>
        </SELECT> &nbsp;                  
      <INPUT id=Submit1 style="BORDER-RIGHT: #333333 1px solid; BACKGROUND-POSITION: 0% 50%; BORDER-TOP: #333333 1px solid; FONT-WEIGHT: normal; FONT-SIZE: 12px; BACKGROUND-ATTACHMENT: scroll; BORDER-LEFT: #333333 1px solid; COLOR: #333333; LINE-HEIGHT: normal; BORDER-BOTTOM: #333333 1px solid; BACKGROUND-REPEAT: repeat; FONT-STYLE: normal; HEIGHT: 18px; BACKGROUND-COLOR: #cee7ef; FONT-VARIANT: normal" onclick="return checkss();" type=submit value=立即查询 name=Submit>       
      &nbsp;&nbsp;                         
        &nbsp;&nbsp;</DIV></TD></FORM></TR></TBODY></TABLE>

<%
  String pid=request.getParameter("bookID");
//  String price=new String();
  String strPrice=new String();  
  String strPrice1=new String();  
  String strPrice2=new String();  
  String strPrice3=new String();  
  double  price;
  String bookName=new String();
  String bookAuthor=new String();
  String publisher=new String();
  Date   pubDate1;
  String pubDate=new String();
  String edition=new String();
  String tips=new String();

  String sql="SELECT * FROM book WHERE bookID='";
  sql=sql+pid;
  sql=sql+"'";
  
  
  byte[] tempBytes=pid.getBytes("ISO8859-1");
  pid=new String(tempBytes);

  try
  {
     Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  }
  catch(ClassNotFoundException e)
  {
     out.println(e.toString());
  }

  try
  {

    Connection con  = DriverManager.getConnection("jdbc:odbc:bookStore");
    Statement  stmt = con.createStatement();
    ResultSet rs=stmt.executeQuery(sql);
      
    while(rs.next())
    {
        bookName=rs.getString("bookName");
        bookAuthor=rs.getString("bookAuthor");
        price=rs.getDouble("bookPrice");       
        strPrice=strPrice.valueOf(price); 
        price*=0.90;
        strPrice1=strPrice.valueOf(price); 
        price*=0.80;
        strPrice2=strPrice.valueOf(price); 
        price*=0.70;
        strPrice3=strPrice.valueOf(price); 
//        price=new Float(price1);
        pubDate1=rs.getDate("pubDate");
        pubDate=pubDate1.toString();
        publisher=rs.getString("publisher");
        edition=rs.getString("edition");
        tips=rs.getString("contentIntroduction");        
    }
    rs.close();  
  }
     
  catch(Exception e)
  {
     out.println(e.toString());
  }
%>


<TABLE cellSpacing=0 cellPadding=0 width=776 align=center border=0>
  <TBODY>
  <TR>
  <td width="1121" colspan="4">
  <hr>
  </TR>
  <TR>
  <td width="149">
  <td width="255">
  <form action="orderView.jsp?bookID=<%=pid%>" method="POST">
    <p> </p>
    <p><IMG src="images/guoqi.gif" name="I1" width="92" height="67" type="image"></p>
  <p><p> <p> <p> <input type="submit" value="放入购物车" name="B3">             
  </form>
  &nbsp;&nbsp;             
    <TD width="355">
      <p><font color="blue" size="3">书&nbsp;&nbsp;&nbsp; 名:</font><font color=green>&nbsp;&nbsp;<%=bookName%>  </font>       
      <p><font color="blue" size="3">作&nbsp;&nbsp;&nbsp; 者:</font><font color=green>&nbsp;&nbsp;<%=bookAuthor%></font>     
      <p><font color="blue" size="3">出 版 社:               </font><font color=green><%=publisher%> </font>             
      <p><font color="blue" size="3">出版日期:               </font><font color=green><%=pubDate%>   </font>          
      <p><font color="blue" size="3">语&nbsp;&nbsp;&nbsp; 种:</font><font color=green>&nbsp;&nbsp;<%=edition%>   </font>    
    </TD>
    <TD align=left width="362"> 
      <p><font color=red>原&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 价:</font><%=strPrice%>     
      <p><font color="#FF0000">1-2星会员价:</font><%=strPrice1%></p>
      <p><font color="#FF0000">3-4星会员价:</font><%=strPrice2%></p>
      <p><font color="#FF0000">5-6星会员价:</font><%=strPrice3%></p>
      <p> </p>
    </TD>
  </TR>
  </TBODY>
</TABLE>
<TABLE height=1 cellSpacing=0 cellPadding=0 width=776 align=center border=0>
  <TBODY>
  <TR>
    <TD height=1 width="176"></TD>
    <TD height=1 width="1050">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <hr>
      <p><font size="3" color="#0000FF"><b>内容简介:</b></font></p>
      <p><font color="blue" size="3">&nbsp;&nbsp;&nbsp;&nbsp;<%=tips%></font></p>           
      <p> </p>
      <p> </TD>
    <TD height=1 width="214"></TD></TR>
  <TR>
    <TD height=1 width="176"></TD>
    <TD height=1 width="1050"> 
      <p> </TD>
    <TD height=1 width="214"></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=776 align=center border=0>
  <TBODY>
  <TR>
    <TD>
      <TABLE cellSpacing=1 cellPadding=0 width="100%" align=center 
      bgColor=#89bec6 border=0>
        <TBODY>
        <TR bgColor=#aacfd5>
          <TD style="PADDING-LEFT: 10px"> </TD>
        </TR>
        </TBODY></TABLE>
      <DIV align=center></DIV></TD></TR>
  <TR>
    <TD height=6></TD></TR>
  </TBODY></TABLE>
<HR align=center width=776 color=#339999 SIZE=1>

<TABLE cellSpacing=0 cellPadding=0 width=776 align=center border=0>
  <TBODY>
  <TR>
    <TD align=middle>版权所有&nbsp;2003-2004&nbsp;&copy;&nbsp;All rights MagicTeam reseverd           
      <p> </p>
    </TD></TR></TBODY></TABLE>         
<DIV align=center></DIV></BODY></HTML>

⌨️ 快捷键说明

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