I encountered the same problem and wrote the following small Java
application to take care of passing URL strings between JSPs that have
spaces. You can call its static method from a JSP page.
/***************************************************************************
***
* QueryString provides a single static method for going through a URL and
* replacing all instances of the space character with %20. This was
created
* because Netscape does not automaticall make this conversion.
****************************************************************************
*/
public class QueryString {
public static String replaceSpaces(String URL) {
String returnURL = "";
int stringIndex = 0;
try {
for (; stringIndex < URL.length(); stringIndex++) {
if (URL.charAt(stringIndex) == ' ')
returnURL = returnURL + "%20";
else
returnURL = returnURL + URL.charAt(stringIndex);
}
} catch (StringIndexOutOfBoundsException E) {
System.out.println("The last available character is at position: "
+ (URL.length() - 1));
System.out.println("stringIndex tried to check position : " +
stringIndex);
}
return returnURL;
}
}
Thanks,
P.J.
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets