Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-21-2011, 08:56 PM   PM User | #1
Antrim
New to the CF scene

 
Join Date: Apr 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Antrim is an unknown quantity at this point
Passing parameters through the URL

Hi everybody. First I'll briefly explain what I'm doing, in case somebody has any extra advice. I'm trying to design an online music store using HTML, JSP, servlets and mySQL. At the left side of the website there's a menu with all article categories: guitars, basses, amps, etc. When the user clicks on any category, the system will search in the database and show a list with all the articles that are part of that category. Only the name of the article (with an hyperlink to the personal page of the article, where all info + 'add to cart' will be) and the price will show in the list.
So far so good, I've done that already. My problem is that right now I'm not really sure on how to create the personal page of each article. My idea is to create a common page for all articles (article.jsp, for example), and pass it the id of the clicked article through the URL, like this: ...href="article.jsp?id=<%= article.getId() %>... so that once in article.jsp, I can know what article was the one clicked, and use the article's id that I've passed through the URL to access the database one more time and show all the article's info.

Questions: I know how to put the parameter in the URL, but how do I read it in the other page? Can I do it using only HTML + JSP, or do I need to use Javascript?

I would love any feedback.

Thanks in advance!
Antrim is offline   Reply With Quote
Old 04-21-2011, 10:02 PM   PM User | #2
Apostropartheid
The Apostate


 
Apostropartheid's Avatar
 
Join Date: Oct 2007
Posts: 3,215
Thanks: 16
Thanked 265 Times in 263 Posts
Apostropartheid is on a distinguished road
Why have you posted this here?

PS: drawing on my PHP knowledge, I would assume you use the getParameter() method of JSP.

Thread moved.
__________________
Blog | Twitter
Useful links: W3C HTML Validator | W3C CSS Validator | HTML 5 Guide
CF: HTML & CSS Resources/Tutorials Thread | HTML & CSS Posting Rules and Guidelines
Remember: no link, no code, no help!
Apostropartheid is offline   Reply With Quote
Old 04-23-2011, 03:21 AM   PM User | #3
Antrim
New to the CF scene

 
Join Date: Apr 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Antrim is an unknown quantity at this point
Sorry about that, and thanks for the help! It worked.
Antrim is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:41 PM.


Advertisement
Log in to turn off these ads.