wood burning stoves*
The moose likes Servlets and the fly likes URL rewriting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "URL rewriting" Watch "URL rewriting" New topic
Author

URL rewriting

Manish Shinde
Ranch Hand

Joined: Mar 30, 2011
Posts: 39
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

Joined: Feb 29, 2008
Posts: 1000
    
    1

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">



Oracle Java Web Service Developer (1z0-897), Oracle certified Java 7 Programmer, SCJA 1.0, SCJP 5.0, SCWCD 5.0, Oracle SQL Fundamentals I
Manish Shinde
Ranch Hand

Joined: Mar 30, 2011
Posts: 39
Thank You
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URL rewriting
 
Similar Threads
URL Rewriting
${cookie.userName.value} doesn't give any value
Session tracking with URL rewriting
problems in URL rewriting
Tag Error