www.webdeveloper.com
Results 1 to 2 of 2

Thread: Java, JSP, & Cookies

Threaded View

  1. #1
    Join Date
    Jun 2006
    Posts
    266

    Java, JSP, & Cookies

    I am new to all of the above as my language of choice is PHP. I am tinkering with JSF and have a file where I am creating a persistent cookie, tracking how many times a page is visited by a particular user. I want to display the number of hits when the page loads.

    This incorrect code is what I have so far for the event-processing:
    Code:
    public void prerender() {
      Cookie cookie = new Cookie(hitsResult);
      HttpServletResponse response = (HttpServletResponse) getExternalContext().getResponse();
      response.addCookie(cookie);
    }
    ... where hitsResult is my JSP component. I'm not even sure if I should be doing it in the prerender method. I'd also like the cookie to expire in a month.

    Could anyone direct me?
    Thanks!
    Last edited by rbragg; 06-08-2010 at 09:44 AM.

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