求修改或者给我JSP购物车代码
我这里的代码是<tr><tdheight="305"align="center"valign="top"background="images/00704200952091...
我这里的代码是
<tr>
<td height="305" align="center" valign="top" background="images/0070420095209135.gif" scope="row" widtd="138"><p class="STYLE4"> </p>
</td>
<td colspan="4" align="left" valign="top" background="images/2008021809220622.gif"><table width="90%" border="1" align="center" cellpadding="0"
cellspacing="0">
<tr>
<%int id;
try {
id = Integer.parseInt(request.getParameter("id"));
} catch (NumberFormatException e) {
id = 0;
}
CDDAO dao=new CDDAO();
CD CD=dao.findCD(id); %>
<td width="90" height="115" valign="top"> </td>
<td valign="top" bordercolor="1"> </td>
</tr>
<tr>
<td height="30" bordercolor="1"> </td>
<td bordercolor="1"><table width="108" border="0" cellspacing="1" cellpadding="0">
<tr>
<td align="center" width="106"><a href="addCDtocart?id=<%=CD.getCDID()%>"
onclick="window.open('shop_cart.asp?id=500047&nowmenuid=500001','shopcart','width=580,height=250,resizable=no,scrollbars=yes')"> <a href="addCDtocart?id=<%=CD.getCDID()%>"><img src="images/BUY.gif" border="0" alt="BUY" /></a></td>
</tr>
但是要和我的工程合起来 我连不上去啊 尤其是
<td align="center" width="106"><a href="addCDtocart?id=<%=CD.getCDID()%>"
onclick="window.open('shop_cart.asp?id=500047&nowmenuid=500001','shopcart','width=580,height=250,resizable=no,scrollbars=yes')"> <a href="addCDtocart?id=<%=CD.getCDID()%>"><img src="images/BUY.gif" border="0" alt="BUY" /></a></td>
</tr>
这一段添加进购物车的我更看不懂 可以帮我修改或者给我一段新的吗?? 展开
<tr>
<td height="305" align="center" valign="top" background="images/0070420095209135.gif" scope="row" widtd="138"><p class="STYLE4"> </p>
</td>
<td colspan="4" align="left" valign="top" background="images/2008021809220622.gif"><table width="90%" border="1" align="center" cellpadding="0"
cellspacing="0">
<tr>
<%int id;
try {
id = Integer.parseInt(request.getParameter("id"));
} catch (NumberFormatException e) {
id = 0;
}
CDDAO dao=new CDDAO();
CD CD=dao.findCD(id); %>
<td width="90" height="115" valign="top"> </td>
<td valign="top" bordercolor="1"> </td>
</tr>
<tr>
<td height="30" bordercolor="1"> </td>
<td bordercolor="1"><table width="108" border="0" cellspacing="1" cellpadding="0">
<tr>
<td align="center" width="106"><a href="addCDtocart?id=<%=CD.getCDID()%>"
onclick="window.open('shop_cart.asp?id=500047&nowmenuid=500001','shopcart','width=580,height=250,resizable=no,scrollbars=yes')"> <a href="addCDtocart?id=<%=CD.getCDID()%>"><img src="images/BUY.gif" border="0" alt="BUY" /></a></td>
</tr>
但是要和我的工程合起来 我连不上去啊 尤其是
<td align="center" width="106"><a href="addCDtocart?id=<%=CD.getCDID()%>"
onclick="window.open('shop_cart.asp?id=500047&nowmenuid=500001','shopcart','width=580,height=250,resizable=no,scrollbars=yes')"> <a href="addCDtocart?id=<%=CD.getCDID()%>"><img src="images/BUY.gif" border="0" alt="BUY" /></a></td>
</tr>
这一段添加进购物车的我更看不懂 可以帮我修改或者给我一段新的吗?? 展开
1个回答
展开全部
看看,能不能帮你:
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<jsp:directive.page import="dao.BookDao"/>
<jsp:directive.page import="entity.BookBean"/>
<html>
<head>
<title>详细内容</title>
</head>
<%
List<BookBean> list=(List<BookBean>)session.getAttribute("list");
int size=list.size();
int bookId=Integer.parseInt(request.getParameter("bookid"));
BookBean book=null;
int i=0;
while(i<size){
book=list.get(i);
if(bookId==book.getBookId())
{
session.setAttribute("bookToAdd",book);
break;
}
i++;
}
%>
<body>
<center>
<h1><font color="red">书名;<%=book.getBookName() %></font></h1>
<h2>价格:<%=book.getPrice() %></h2>
<h2>描述:<%=book.getDescription() %></h2>
<form action="/book/AddBookToCart" method="post">
<input type="submit" value="放入购物车" ></form> <input type="button" name="button2" value="查看购物车" onClick="window.location.href='cart.jsp'">
</center>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<jsp:directive.page import="dao.BookDao"/>
<jsp:directive.page import="entity.BookBean"/>
<html>
<head>
<title>详细内容</title>
</head>
<%
List<BookBean> list=(List<BookBean>)session.getAttribute("list");
int size=list.size();
int bookId=Integer.parseInt(request.getParameter("bookid"));
BookBean book=null;
int i=0;
while(i<size){
book=list.get(i);
if(bookId==book.getBookId())
{
session.setAttribute("bookToAdd",book);
break;
}
i++;
}
%>
<body>
<center>
<h1><font color="red">书名;<%=book.getBookName() %></font></h1>
<h2>价格:<%=book.getPrice() %></h2>
<h2>描述:<%=book.getDescription() %></h2>
<form action="/book/AddBookToCart" method="post">
<input type="submit" value="放入购物车" ></form> <input type="button" name="button2" value="查看购物车" onClick="window.location.href='cart.jsp'">
</center>
</body>
</html>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询