• Post Reply Bookmark Topic Watch Topic
  • New Topic

URL Encoding  RSS feed

 
Pankaj Kumarkk
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am reading the session management topic in servlet/jsp. It says that you can manage sessions using URL encoding technique.
My question is who puts the session id in the URLs. As per my understanding it is the container who does it(if we have used response.encodeURL call)

So does this mean that if I have a jsp which has a lots of hrefs then the container would automatically encode each of those URLs with session id.

 
Pankaj Kumarkk
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have got the answer to this question.
If you have a lot of Hrefs in your jsp and you want to have stateful behavior (using HttpSession) then you have encode each of Hrefs using HttpResponse.encodeURL. Thus it is the developer who ensures that all URLs on a jsp page are encoded with a session id(by calling encodeURL to each one if them)
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In any JSP written since 2002, using <c:url> will perform the rewriting when necessary.
 
Sameer Sebastian
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can a developer encode a URL with a sessionId in a JSP page?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Already answered:
Bear Bibeault wrote:In any JSP written since 2002, using <c:url> will perform the rewriting when necessary.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!