Use %20 as the replacement of Blank spaces...
Ritesh





"Vinay K.V. Menon" <[EMAIL PROTECTED]> on 06/20/2000 04:01:02
PM

Please respond to "A mailing list for discussion about Sun Microsystem's
      Java              Servlet API Technology."
      <[EMAIL PROTECTED]>

To:   [EMAIL PROTECTED]
cc:    (bcc: Sinha Ritesh-SWD-ITIL-UB/Itilmail)

Subject:  Passing spaces in query strings




Hi all!
        I am having a problem passing parameters with spaces in the middle
to
servlets.
        I tried encodeUrl but it does not seem to encode the spaces with
+'s. So I
looked up the archive and found that I could use the URLEncoder.encode
method. Well, this method seems to be working fine as far as converting the
spaces to +'s go but when I try to do an encodeUrl of that string and a
sendRedirect it seems to be failing. Here is what I am trying to do,

response.sendRedirect(response.encodeUrl(java.net.URLEncoder.encode(sURL)))
;

And for one of the cases with spaces here is what I get,

500 Internal Server Error

The servlet named invoker at the requested URL


http://localhost/servlet/polyx.application.FileDeleteServlet?AREAID=A1&DOCU
M
ENTID=4&FILENAME=Article+Writer+Functional+Specifications.doc

reported this exception

polyx.application.FileDeleteServlet?AREAID=A1&DOCUMENTID=4&FILENAME=Article
+
Writer+Functional+Specifications.doc:

polyx.application.FileDeleteServlet?AREAID=A1&DOCUMENTID=4&FILENAME=Article
+
Writer+Functional+Specifications.doc. Please report this to the
administrator of the web server

when I click the URL[above url that comes in the error message] in the
browser it works! Can somebody tell me how to go anbout handling spaces?

        IE seems to encode the URL directly without the use of the
URLEncoder but
including the URLEncoder.encode methid it does not work in IE either.

Thanks and advance

Vinay

___________________________________________________________________________
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