• Post Reply Bookmark Topic Watch Topic
  • New Topic

can you pass ID's in hyperlinks

 
Taz Coello
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
I've created a JSP page that lists all the categories from a database as hyperlinks, but i want the following page to display only the related products to that category. Can this be done?
I have managed to allow users to select a radio button that then takes them to a page listing all the related products but this looks un-proffessional.
NB: Just to clarify things further, I just wanted to state that i'm creating an online shopping site using JSP and HTML tags and Access as the database.
[ March 03, 2004: Message edited by: Taz Coello ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, you just construct a query string on the URL and the tuple(s) gets passed as a request parameter. For example:

the request parameter 'productId' would contain the value '123'.
Is that what you are after?
 
Taz Coello
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its kind of what i'm after, although I dont actually want to specify the productID myself-this depends upon what category the user selects.
for example: category is "Drinks" (this is a hyperlink that user selects)
I then want to get the ID for drinks from my database (from category table)and display the products that have this ID (from products table that has relationship with category table)
Does this make sense?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, no difference really:

You're best bet is for the link to submit to a servlet (in this case mapped to getProductsInCategory) which uses the value of the 'category' param to interact with the Model to fetch the list of products. This list gets forwarded to a JSP for display.
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In addition, if you dont wanna hard code the parameter link inside <a href>,
you can add an *onClick* attribute, and invoke a JavaScript to determine the parameter for you, and then submit or request for the target page.
Nick.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!