Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

itemcode to servlet

 
Sachin Kadian
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic