This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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: 41634
    
  55
I'm not familiar with that example, but the way to obtain a rewritten URL is to use the HttpServletResponse.encodeURL method.


Ping & DNS - my free Android networking tools app
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  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