• Post Reply Bookmark Topic Watch Topic
  • New Topic

response.encodeURL("")

 
aakash punnamaneni
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm trying to get the jsessionid cookie value using the following line in my jsp. It always returns empty string. Is this correct behaviour? Thanks.
response.encodeURL("")
 
Devaka Cooray
Marshal
Posts: 5175
490
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's highly likely you are trying to do something that you shouldn't. Messing up with session cookie is something the container takes care of. What are you trying to accomplish with session cookie's value?
 
Ron McLeod
Saloon Keeper
Posts: 1263
131
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are encoding an empty string, and getting an empty string back - seems like encodeURL is working as expected.

If you want to get the value for session ID you could try something like request.getSession().getId()
 
Devaka Cooray
Marshal
Posts: 5175
490
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And, for whatever reason you are doing it, you should do it in a Servlet and never in a JSP. Again, having to mess up with session token's value indicates something is wrong in your application design.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!