• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can I find out the originating link to my jsp using javascript?

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a problem.

I have a jsp page that is accessed via two different links. Depending on from which link it (the page) is accessed from, I want to display different text.

Suppose I cannot have seperate jsp pages for each link. is there a way I can identify which link it accessed from? Using javascript?
 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure if i understood you properly !!

Can't you pass some parameter in the Query String to differentiate between 2 links ?

otherwise you have to call a js function on clicking link, set a value in hidden field and submit a form inside the js function.

-Rajeev
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why would you use JavaScript when you could use the jsp to change the text. IT is more reliable that way.

Eric
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understood the question until you said you wanted to use Javascript to find what page requested your JSP. By the time you can use Javascript you've already generated the page and it's too late to find out. In a servlet you would use, I believe,to find the URL of the page that requested the servlet. I assume you can put that into a JSP as well.

Have you considered what you are going to do if somebody bookmarks the URL of your JSP and has the browser request it directly? You might want to consider Rajeev's suggestion.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic