aspose file tools*
The moose likes Servlets and the fly likes itemcode to servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "itemcode to servlet" Watch "itemcode to servlet" New topic
Author

itemcode to servlet

Sachin Kadian
Ranch Hand

Joined: Jan 24, 2012
Posts: 33
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???
Piyush Mangal
Ranch Hand

Joined: Jan 22, 2007
Posts: 196
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.



Sachin Kadian
Ranch Hand

Joined: Jan 24, 2012
Posts: 33
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???
Sachin Kadian
Ranch Hand

Joined: Jan 24, 2012
Posts: 33
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??
pravin venkat
Greenhorn

Joined: Mar 30, 2012
Posts: 20
Sachin Kadian wrote: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??


you can have a hyperlink tag with id attribute having item code
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60053
    
  65

pravin venkat wrote:you can have a hyperlink tag with id attribute having item code

An id on the anchor tag will be of no help. Those are just markers for client-side JavaScript.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: itemcode to servlet
 
Similar Threads
Determing what list item got clicked
I want two buttons on a page, one for "search refine", one for "submit", how to do ?
JList
How do I?
Check if updates were made before page unload