Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Handling without Cookies

Chris Rzohli
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I use Mojarra 2.1.2 under Tomcat 7.0.12. I want to write a JSF application using facelets that also works with cookies disabled in the client. Only using servlets and JSP, this works perfectly, you only have to response.encodeURL each URL which is displayed to not loose the current session.

How to manage that in JSF?

I have a simple facelet, say demo.xhtml, wich contains something like this

<h:commandLink value="Login" action="#{bean.doSomething()}" />

With cookies enabled, clicking on the link works as desired and the content of the doSomething() method of the ManagedBean bean (in RequestScope) is executed. However, clicking on the link after disabling cookies raises viewId:/facelets/demo.xhtml - View /facelets/demo.xhtml could not be restored.

The source obtained via the browser shows that there is no sessionid appended to the link. Then the server cannot identify the session any more.

The same with a <h:commandButton>, and with Glassfish 3.1 and its own JSF Library.

Does anyone have an idea what I am missing to not lose sessions without cookies?

Thank you.

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic