This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
i am designing website for a shopping mall. i put some items to purchase. i want when the user click on a item , its information is shown to the user. so for that i created a servlet that will redirect the user to the item information jsp page where values will be set as the item clicked. now suppose the user click on 1 item , its itemcode must goes to the servlet so that the servlet can find out its information from the database and show that information on the jsp page. for one item its easy but i have many items so how the servlet will find that which item was clicked??? how i can send the itemcodes to the servlet???
As you mentioned, user will be redirected to item information page once user clicks on an item.
Each item would have an item code associated with it which you can pass to Servlet via request parameter.
For Example lets say you have 2 items on the cart, item1 and item2 with corresponding item codes itemcode1 and itemcode2. When user clicks on item1 ,you can pass itemcode1 to Servlet ,
and when item2 is clicked , itemcode2 can be sent to the Servlet.
Joined: Jan 24, 2012
The main problem is how i attach an item code with a item. suppose there are 2 items item1 and item 2. only image of those items and name of those items are displayed to the user. In html page i have only image and text under that. so how i attach a itemcode to that item. please help me here. should i give that item code in a label??? if i give in label that my servlet code will be like this
[code] request.getParameter("labelname"); [code]
but there are many items . suppose 2 items code are itemcode1 and itemcode2 . for both the items i would have to make 2 different labels . means there name will be different. so can i use pick the value from the specific label in servlet???
Joined: Jan 24, 2012
if i click on item1 image its item code should go to the servlet and if i click on item2 image its item code should go to the serlvet and so on. how i can do so in html page??