• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hyperlinks  RSS feed

 
david allen
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on my first web application - Photo Album. I have a JSP page that retrieves an image from each album. The client can then click on this to take them to the rest of the photos in that album. However, I am pretty sure that the hyperlink should be something like "http://localhost/examples/albums/album1" but I dont understand how this should be passed to my other jsp Page displayAlbum.jsp to determine which album it should display.
Thanks in advance.
 
Debashish Chakrabarty
Ranch Hand
Posts: 231
Firefox Browser Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David:
You may pass the member name or unique id for the member or album through
  • query string
  • If there is a midlying page you may pass the value inside a hidden form field

  • With query string your URL will look something like http://localhost/examples/jsp/displayAlbum.jsp?album=album1. To dynamically generate this hyperlink however you will have to add the query string for eg.
    Talking of your album page however you can generate the hyperlinks dynamically in the JSP itself (which is displaying all images and where the user would click to view his album). So the hyperlink for image 1 would be, say, http://localhost/examples/jsp/displayAlbum.jsp?album=album1 and so on.
    Did it help? Do get back..
    [ February 13, 2003: Message edited by: Debashish Chakrabarty ]
     
    david allen
    Ranch Hand
    Posts: 185
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Debashish,
    Thank you very much for that. I now have it working and can easily associate the album name with each album link. It is much easier than I thought.
    One other question. The hyperlink being "http://localhost/examples/jsp/displayAlbum.jsp?album=album000"
    What happens if I change the name of the server or servers. Is there some function that can get the server name so for example hyperlink = getServerName() + /examples/jsp/displayAlbum.jsp?album=album000"
    thanks for your help
    david
     
    Debashish Chakrabarty
    Ranch Hand
    Posts: 231
    Firefox Browser Spring
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    You would not normally write the absolute URL in such cases. Since you would be aware where your JSPs are (eg.in the present case while you are testing the JSPs on your own machine and know that all of them are in examples/jsp directory of your webserver directory), all your URLs would be app relative URLs for eg:

    The URL specified is normally interpreted relative to the JSP page that refers to it, but, as with relative URLs in general, you can tell the system to interpret the URL relative to the home directory of the Web server by starting the URL with a forward slash.
    Regards
    [ February 14, 2003: Message edited by: Debashish Chakrabarty ]
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!