the correct way to pass the parameters having spaces in between is to put
the values in the single or double quotes. That'll solve your problem.




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

Please respond to A mailing list about Java Server Pages specification and
      reference <[EMAIL PROTECTED]>

To:   [EMAIL PROTECTED]
cc:    (bcc: Kher Tamanna-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: 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

===========================================================================
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

Reply via email to