in my project we used the following code in many pages and i did not understand the use of this
Code:
HttpServletRequest request = (HttpServletRequest) FacesContext
.getCurrentInstance().getExternalContext().getRequest();
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName()
+ ":" + request.getServerPort() + path;
this.basePath = basePath;
HttpSession session = (HttpSession) FacesContext.getCurrentInstance()
.getExternalContext().getSession(false);
SessionVO sessionBean = ((SessionVO) session.getAttribute("sessionDto"));
this.commentVO.setCurUserId(sessionBean.getUserId());