Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How do you access HttpServletResponse in JSF  RSS feed

 
Adam Zedan
Ranch Hand
Posts: 124
C++ Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay I have run into a little problem here.. I need to use HttpServletResponse to access and pass around cookies.
Here is the thing the front is the facelet page and it gets its entire contents from a bean (a managed bean) at the back end and this managed bean is a pojo i was looking here http://gthill.blogspot.com/2008/01/cookies-in-jsf.html and it says that i have to use HttpServletResponse ?? How can i use HttpServletResponse in a pojo (bean)??? Am i missing anything ?? any help would be appreciated thanks..
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This sounds like a revival of your earlier question http://www.coderanch.com/t/544124/JSF/java/obtain-response-object-jsf . As a rule, we'd rather you just continue the original thread, to avoid confusion. Then again, we also discourage "bumping", so you can't win.

Your problem is that you assumed the solution before considering what the real question was. What you ACTUALLY want is access to cookies. The fact that HttpServletResponse is the low-level mechanism that does that isn't really the point, since, as I mentioned in the previous thread, the servlet response stream isn't really yours to play with in JSF.

On the other hand, I managed to find a much more elegant solution about 3 entries down on the Google list from the one you did:

http://stackoverflow.com/questions/5557710/how-to-use-cookies-in-jsf
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!