Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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!

  • #2
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Why have you posted this here?

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

    Thread moved.

  • #3
    New to the CF scene
    Join Date
    Apr 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry about that, and thanks for the help! It worked.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •