You don't need to do this - just call HttpServletResponse.encodeURL() on the
URL before sending it!

Kevin Jones
DevelopMentor
www.develop.com

> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Srini
> Sathya.
> Sent: 20 September 2000 18:46
> To: [EMAIL PROTECTED]
> Subject: Re: problem calling to a servlet
>
>
> IMHO!! when you pass a query which contains spaces it has to be changed to
> "+", special characters are not recognized as part of submission.
>
> I am attaching a code snippet which checks if the query string
> contains " "
> and if yes then it will replace with "+".  Pass your query as a
> parameter to
> the method replaceStrings().
>
>                 *********************
>
>         public boolean isSpace(String strParm)
>         {
>                 boolean loboo_IsSpace = true;
>
>                 //If u dont find a space then u return false
>                 if ( strParm.indexOf(" ") == -1 )
>                 {
>                         loboo_IsSpace = false;
>                 }
>
>                 // if u find a space then return true
>                 else
>                 {
>                         loboo_IsSpace = true;
>                 }
>
>                 return loboo_IsSpace;
>
>         }
>
>         public String replaceStrings(String strParmQuery)
>         {
>                 String lows_String = strParmQuery;
>                 if ( isSpace(lows_String) )
>                 {
>                         lows_String = lows_String.replace(' ', '+');
>                         return lows_String;
>                 }
>                 else
>                 {
>                         return lows_String;
>                 }
>
>         }
>                 *****************
>
> Cheers
> Srini
>
> -----Original Message-----
> From: Marcos Lloret [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 20, 2000 5:43 PM
> To: [EMAIL PROTECTED]
> Subject: problem calling to a servlet
>
>
> hi list,
>
>     i have a string like this =  'Man clothes'
>
> when i call a servlet i do it like that:
>
>     ..../servlets/myservlet?str=Man clothes&......
>
> but it does not work.. because it only gets up to
>
>     ..../servlets/myservlet?str=Man
>
> but i need all the string because i have to look for this string into a
> database.
>
>
> any suggestions will be pleased,
>
> marcos
> [EMAIL PROTECTED]
>
> __________________________________________________________________
> _________
> To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> __________________________________________________________________
> _________
> To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to