www.webdeveloper.com
Results 1 to 3 of 3

Thread: referer

  1. #1
    Join Date
    Jan 2003
    Location
    PA
    Posts
    1,898

    referer

    I have some logic that checks the value of the refering page.
    Code:
    HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest();
    	String referer = request.getHeader("Referer");
    Then I have this logic:
    Code:
    if (!referer.endsWith("/locator/") && !referer.endsWith("index.jsf")) {
    								sessionScope.remove(UtilityConstant.HEADER_LOGO);
    							}
    But the issue run into now is that if my referer ends with index.jsf?somevar=somevalue, my logic no longer works. How can I make this logic work if the referer has request variables on the end of it?

    Thanks

  2. #2
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,119
    put another condition that makes sure you are validating for index.jsf such as if(referrer.equals("index.jsf")){
    }else{
    //either referrer has no value or there are some other nae=value pairs attached
    }
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

  3. #3
    Join Date
    Jan 2003
    Location
    PA
    Posts
    1,898
    thanks, I got this working a different way. I can't just look for index.jsf because I have 2 index.jsf pages, in defferent directories, that are using the same managed bean, but I came up with another solution.

    Thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles