• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to tranfer cookie with jsp ?

 
Hiep Nguyen
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi room,
in case webrower is turned cookie off, so we can't create an cookie file on client's machine. I know in servlet we can use URL rewriting :

response.encodeURL(url);
//it will return an with parameter JSESSIONID=xxx.. belong to url

could you tell me how can i do the same with jsp ?

Thank you,
Hiep
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The non-elegant solution would be to use the same code you'd use in a servlet only in a scriptlet as in:


A more elegant solution would be to find a custom taglib that does the same thing. Someone else may be able to suggest one.
 
Hiep Nguyen
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Merrill,
Thank you for your response.
I have tried the solution before posting the question but URL is after encoded nothing change, it means it doesn't attach the session id to URL as servlet.
does any one has other suguest?
Thank you,
Hiep
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try response.encodeRedirectURL().

HTH
 
Eugene Lucash
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to use JSTL's tag <c:url value="some.jsp">




Or you can use Strut's tag <html:rewrite >
<html:rewrite page="/assets/page.js"/>
[ February 21, 2005: Message edited by: Eugene Lucash ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!