File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes How to use url rewriting in servlets 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 » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "How to use url rewriting in servlets" Watch "How to use url rewriting in servlets" New topic
Author

How to use url rewriting in servlets

bhaskaritp naidu
Ranch Hand

Joined: May 21, 2007
Posts: 45
Hi All,

if cookies disabled , we can use url rewriting to maintain session state.

but i am not understanding urlrewriting thing.

in hfsj book they mentioned this code in doGet method.


out.println("");



what is the BeerTest.do here?

will it make new link in client browser?

if it make new link, what about actual design page of client?

Please clarify my doubts.

Thanks
Bhaskar
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39535
    
  27
I'm not familiar with that example, but the way to obtain a rewritten URL is to use the HttpServletResponse.encodeURL method.


Ping & DNS - updated with new look and Ping home screen widget
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

in hfsj book they mentioned this code in doGet method.
out.println("");

Which page exactly are you talking about. Please post a little excerpt from the code to show us actually what that code is doing. In a servlet URL rewriting can be done using HttpServletResponse.encodeURL/encodeRedirectURL and in JSPs it can be done using c:url tag...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
bhaskaritp naidu
Ranch Hand

Joined: May 21, 2007
Posts: 45
Sorry that example like this

out.println("<a href=\""+response.encodeURL("/BeerTest.do")+"\"click me</a>");
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use url rewriting in servlets
 
Similar Threads
Session Tracking
redirecting the request to URL
URL rewriting ?
Passing a session from a servlet to a JSP
url rewriting