Hi!
when you use request.getParameter("book_id"), it will return a string value.
You are trying to store a string into an integer. You have to type cast it
like the below,
<% int ibook_id = Integer.parseInt(request.getParameter("book_id")); %>
Another mistake you have done is inside the request.getParameter you should
give the string in double quotes.. in your case it is missing...
Hope this will help you
Muthu
----- Original Message -----
From: "Preeti" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 28, 2001 8:37 AM
Subject: shopping cart help
> Hi guys
> 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
> ..
> I receive error in this piece of code :
>
> <% int ibook_id = request.getParameter(book_id);%>
> <% disB.setBook_id(ibook_id);%>
>
>
> code for the JSP page is : --
>
>
> <%@page language="java" import="java.util.*"%>
>
> <%@page import="shop.disBean"%>
>
> <HTML>
> <HEAD>
> <TITLE>
> Display Products
> </TITLE>
> </HEAD>
> <BODY topmargin="0" leftmargin="0">
> <table cellspacing="2" cellpadding="2" border="1">
> <tr>
> List of Book
> <table border="3">
> <tr>
> <td>Book Name</td>
> <td>Price</td>
> <td>Publisher</td>
> <td>CD</td>
> <td>Category Name</td>
> <td>Buy</td>
> </tr>
>
> <% Vector vect=new Vector();
> disBean disB=new disBean();
> disB.connect();
> vect=disB.query();
> int size=vect.size();
>
> for(int i=0;i<size;i++)
> {
> Object refObj=vect.elementAt(i);
> disBean strRecord=(disBean) refObj;
>
> %>
> <tr>
> <td><%= strRecord.getBook_name()%></a></td>
> <td><%= strRecord.getPrice()%></td>
> <td><%= strRecord.getPublisher() %></td>
> <td><%= strRecord.getCd() %></td>
> <td><%= strRecord.getCategory_name() %></td>
> <td><a href="dis.jsp?book_id=<%=strRecord.getBook_id()%>">add to
> cart</a></td>
> </tr>
> <%}%>
> <% int ibook_id = request.getParameter(book_id);%>
> <% disB.setBook_id(ibook_id);%>
>
> </table>
> </td></tr></table>
> </BODY>
> </HTML>
>
>
> pls help me
> Regards Preeti
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets