Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URL rewriting

 
Manish Shinde
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some doubts in URL rewriting.
I have made servlet UrlRewrite.java where I m using encodeURL() and then going to
Page Hi.jsp.
When clicked on link, I got Hi.jsp page and jsession id appended to the url.
Then I clicked on link & went to bye.jsp
But this time I go the output as "session is new" .

Question :
1)Is it necessary to use response.encodeURL() everytime when you are navigating form one page to another using <a href=""></a> tags. ?
2)when I use requestDispatcher from Hi.jsp to Bye.jsp.then i got output "session is not new", WHY ?

NOTE : I have disabled browser cookies.





Thanks in advance.
manish
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Yes
2. because session is not chnaged as you move from Hi.jsp to Bye.jsp

By the way , your Hi.jsp code is wrong. correct code is

<%@page contentType="text/html" session="true" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

 
Manish Shinde
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic