Sunday, June 27, 2010

Getting client and server sessionId in JSF

Code for Generating ClientSide SessionId:
var sesid = document.cookie;//this will give client sessionid and stores in sesid variable


Code for Generating ServerSide SessionId:
//this method will return the server side session id using getId() method
private String serverSessionid() {
HttpServletRequest hrq = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
HttpSession session = hrq.getSession();
rtnString = session.getId();
//System.out.println("SESSION ID"+rtnString);
return rtnString;
}

JSF Related topics: JCaptcha in JSF, Integrating Richfaces with JSF,Getting client and server sessionId in JSF,PopUp AlertMessagebox for JSF and more.....

No comments:

Post a Comment