aspose 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 Java 8 in Action this week in the Java 8 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
Ranch Hand

Joined: Aug 06, 2010
Posts: 359
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: Java EE 6 Web Component Developer
Oracle Certified Expert: Java EE 6 Enterprise JavaBeans 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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sessions in JSF
 
Similar Threads
My query is null
How Keep a Session Data In JSF
How to destroy the Object of a SessionScoped bean
How to get session scope backbean
How to access session variable in the jsf page