[thelist] dyanmic file path change based on referrer

Hassan Schroeder hassan at webtuitive.com
Tue May 4 13:49:31 CDT 2004


Matt Newell wrote:

> i've got a problem that i'd like some help with. i'd like to dynamically
> replace the filepath of an include on a JSP page based on a string
> inside the referring url. essentially there is a shared page on a site
> but should have the proper navigational include for which section the
> user was using prior to getting to this page.
> 
> i was thinking about trying to read the http_referrer output and create
> a table of variables and the proper url to then be called into the page
> via javascript or jsp. 

If these referring pages are on your site, I wouldn't count on the
referrer -- set a session variable on each request indicating which
section the user is in, and use that to determine your navigational
include.

If you implement this as a Filter, you don't even have to change any
of the section pages, and you can put the nav mapping in a properties
file to read at application start-up.

If you're not familiar with Filters, see the samples that come with
Tomcat.

HTH!
-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.




More information about the thelist mailing list