Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: pls solve my shopping cart problem


Message #1 by "Preeti" <preetisikri@h...> on Wed, 28 Feb 2001 15:12:47 -0500
Hey guys
I asked earlier also pls solve my problem
Actually I'm working on a shopping cart using JSP and SQL Server and I'm
also very new to JSP..
Now this is my first page on which I'm showing all  the products and 
have a
link which is called add to cart
and what I want is that when I click on that link it should refresh the 
same
page and it should  show me the book_id on which the user has clicked 
but
I'm not able to show that Pls help me out in this as it is very very 
urgent:

my jsp code is :
<%@page language=3D"java" import=3D"java.util.*"%>

<%@page import=3D"shop.disBean"%>

<HTML>
<HEAD>
<TITLE>
Display Products
</TITLE>
</HEAD>
<BODY topmargin=3D"0" leftmargin=3D"0">
<table cellspacing=3D"2" cellpadding=3D"2" border=3D"1">
<tr>
List of Book
<table border=3D"3">
<tr>
<td>Book Name</td>
<td>Price</td>
<td>Publisher</td>
<td>CD</td>
<td>Category Name</td>
<td>Buy</td>
</tr>
<%--int ibook_id;--%>
<% Vector vect=3Dnew Vector();
    disBean disB=3Dnew disBean();
    disB.connect();
    vect=3DdisB.query();
  int size=3Dvect.size();

    for(int i=3D0;i<size;i++)
    {
    Object refObj=3Dvect.elementAt(i);
    disBean strRecord=3D(disBean) refObj;

  %>
<tr>
<td><%=3D strRecord.getBook_name()%></a></td>
<td><%=3D strRecord.getPrice()%></td>
<td><%=3D strRecord.getPublisher() %></td>
<td><%=3D strRecord.getCd() %></td>
<td><%=3D strRecord.getCategory_name() %></td>
<td><a href=3D"dis.jsp?book_id=3D<%=3DstrRecord.getBook_id()%>">add to 
cart</a></td>
</tr>
<%
}%>
<% if (QueryString=3Dnull){
      out.print("nothing is passed");
        }
    else
    {
      out.print("Something is passed");
    }
%>
<%ibook_id =3D Integer.parseInt(request.getParameter("book_id"));%>
<%disB.setBook_id(ibook_id);%>
<%=3D disB.getBook_id()%>

</table>
</td></tr></table>
<br>
%>
</BODY>
</HTML>

pls solve this problem that will be great
Regards Preeti 


  Return to Index