|
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!
|