Hi all ,
I am developing a bookstore application for my school project with
JSP ,
JAVA Beans and
servlets.
Initially user goes to the home page and searches for a book using some criteria and it pulls the matching records.
For example
Author isbn price
JavaProgramming 157668 35 AddTo Cart
JavaServlets 548698 45 AddTo Cart
For the above output the following is my html code
<form action="/IS_Project/jsp/addtocart.jsp">
<table border=1 align=center >
<tr>
<td>Author</td><td>Title</td><td>Price</td><td>ISBN</td></tr>
<% while ( it.hasNext() )
{
book = (Book)it.next(); %>
<tr>
<td><% out.println(book.getAuthorFirstName()+book.getAuthorLastName()); %></td>
<td><% out.println(book.getTitle()); %></td>
<td><% out.println(book.getPrice()); %></td>
<td><% out.println(book.getIsbn()); %></td>
<td><input type=submit value="ADDTO CART"></td>
</tr>
<%
}
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
%>
</table>
</form>
Here when the user clicks on Addto Cart i am calling the addtocart.jsp.In the addtocart.jsp i am calling a java bean.
Now my problem is how to retrieve the values of the book the user added to their cart in the jsp or java bean.
How should I do that .I know I should use the request.parameter(" "), I am not undestanding how ?
Here is my jsp , if it helps
<%@ page import="com.archana.is_project.bookstore.user.beans.UserAccount" %>
<%@ page import="java.sql.*" %>
<html>
<body bgcolor="#FFDAB9">
<%! UserAccount userinfo; %>
<%
userinfo = (UserAccount) session.getAttribute("userinfo");
if (userinfo == null)
{
out.println("<h2 align=center>you are not loged in, please login below</h2>"); %>
<jsp:include page="login.html" />
<% }
else {
//here i want to call the bean , including the user selcted book information
out.println("your book is added to your cart");
}
%>
</body>
</html>
Please help me, as i have to submit my school project in 15 days , I am tensed up.
Archana