• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URL Problems - URGENT

 
saquib nisar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help.
We have servlet which generates a table of data, and allows the user to select a entry to update, by clicking on a URL (built with URLEncode).
When we click on the URL (for example http://localhost/servlet/Test), this will take us into a form (generated from within the same servlet), where the action on the for is ACTION='test'. On submit of the form, this posts back
to the same servlet, but the URL at in brower now says 'http://localhost/servlet/Test/Test' and the next time a URL is clicked on the URL says 'http://localhost/servlet/Test/Test/Test'.
Any idea why this is happening? Webserver is Iplanet Fasttrack.
Saquib
 
KMukhar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm don't know if this is causing or contributing to the problem, but from your email, you may not be using URLEncode properly. I'm not even sure which class and method you are referring to.
First, there is a class called URLEncoder with a method named encode(String). This method takes a URL and puts it into a special format. This is used when the URL has extra information tacked onto it; something like the URL for the page I am using to reply to your message. Here's the URL: "http://www.javaranch.com/cgi-bin/ubb/postings.cgi?action=reply&forum=Servlets+and+JSP|APO|s&number=7&topic=001347.cgi&TopicSubject=URL+Problems+-+URGENT." All that stuff that follow the ? is the extra information. Sometimes that extra information may contain characters that can't be displayed properly, or would cause problems in parsing the URL. Space characters are an example of that. In the URL above, all the space characters have been converted to + characters. Other special characters are converted into the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the lower 8-bits of the character.
Then there is a method named encodeURL(String) which is part of the HttpServletResponse class. This takes a URL and adds session id information onto it. This is used when you are doing session tracking and the client does not allow cookies.
From your message, it does not seem that you should be using either of those methods (although you may have left that information out for simplicity). If you aren't adding extra information to the URL that needs to be encoded, and if you are not doing session tracking, you might try removing the encoding call, and see if that makes a difference in the behavior you are seeing.
 
saquib nisar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. We are using encodeURL - sorry for the confusion.
I have just discovered a KB entry on the IPlanet support site, which states that encodeURL causes problems such as I have seen. The soloution is to use absolute paths in the URL or to put ../ in front of the URL.
Has anyone else seen problems with encodeURL and IPlanet? Ther same servlets seem to work OK with Tomcat/Apache.

Thanks for responses.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic