Results 1 to 1 of 1
Thread: Sending fields to servlets
- 12-23-2011, 10:24 PM #1
Member
- Join Date
- Oct 2011
- Posts
- 49
- Rep Power
- 0
Sending fields to servlets
I am trying to create an auction website. I have a table that contains the item data. What I want is, when a user clicks on "Buy item", to get the item id of this specific item, so that I can tell it is a bought item. Here is the code from the jsp.
Java Code:int itemnumber = ItemDAO.getitemRowcount(); for(int i = 0; i < itemnumber; i++) { ItemBean bean = new ItemBean(); bean.setItemid(i+1); // I want to have this id on the server side, when "Buy item" is pressed, and the jsp is sent to BuyitemServlet bean= ItemDAO.getItems(bean); String itemtitle = bean.getItemTitle(); String itemdescription = bean.getItemDescription(); double itemprice = bean.getPrice();%> <tr> <td> Image </td> <td> <%= itemtitle %> </td> <td> <%= itemdescription%> </td> <td> <%=itemprice%> </td> <td> <form action ="BuyItemServlet" method = "post" > <input type = "submit" value = "Buy item"> </td> </tr> </form> <% }
Similar Threads
-
sending JMS messages to different queues than the one sending from
By Dark-Redd in forum Advanced JavaReplies: 0Last Post: 11-07-2011, 09:48 AM -
How to use fields from other methods?
By jim01 in forum New To JavaReplies: 21Last Post: 05-23-2011, 02:38 AM -
Servlets class not teaching servlets
By tsky in forum Java ServletReplies: 5Last Post: 04-26-2011, 10:47 PM -
Static fields
By Eranga in forum Advanced JavaReplies: 25Last Post: 08-29-2009, 11:06 AM -
Sending an object via sockets - all fields but array updating
By Wassa in forum NetworkingReplies: 6Last Post: 12-29-2008, 03:14 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks