• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

itemcode to servlet

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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???
 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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??
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic