File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Sessions in JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Sessions in JSF" Watch "Sessions in JSF" New topic
Author

Sessions in JSF

Renjith Jose
Greenhorn

Joined: Jun 21, 2011
Posts: 2
Hello all,
I need to know the difference between following statements

HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true);
and
HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
Dieter Quickfend
Bartender

Joined: Aug 06, 2010
Posts: 543
    
    4

same as the HttpRequest.getSession(boolean) methods. It's the same as getSession(), except when false is passed as a parameter, the container will not create a new session if there is no session, and will instead return null. getSession(true) is identical to getSession().


Oracle Certified Professional: Java SE 6 Programmer && Oracle Certified Expert: (JEE 6 Web Component Developer && JEE 6 EJB Developer)
Renjith Jose
Greenhorn

Joined: Jun 21, 2011
Posts: 2
Dieter Quickfend wrote:same as the HttpRequest.getSession(boolean) methods. It's the same as getSession(), except when false is passed as a parameter, the container will not create a new session if there is no session, and will instead return null. getSession(true) is identical to getSession().


Thanks...
 
wood burning stoves
 
subject: Sessions in JSF