rbragg
06-08-2010, 08:41 AM
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:
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!
This incorrect code is what I have so far for the event-processing:
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!