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

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

Joined: Aug 03, 2008
Posts: 9339
    
  19

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