This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
i have a servlet that is using the request objects getParameter() method to retrieve a string. The string contains a double quote (") and is therefore truncated somewhere between the client and the servlet. Is there anyway to retrieve the value in it's entirety without truncating? the value is (3/16"):ABSBT. Am only getting (3/16
This needs to be handled when the parameter is being posted, not when being retrieved. If the request parameter is posted as part of a form, all would be well. So I suspect that somewhere along the line the parameter is being tacked onto a URL "by hand". When doing so, it is very important to make sure that the parameter value is url-encoded using java.net.URLEncoder. hth, bear
Thank you for the quick response. Actually, the field is part of an HTML textbox. The getparameter just gets the value from the text box. If the user types in a double quote, it is too late to encode it isn't it.
It isn't being passed in as part of the query string. The method is post. Thank you again.
If the value is being posted via a form it is certainly being sent across correctly unless there's a serious bug in your web server. A quote character is most certainly not an illegal character and a user is free to enter it into a text field. Are you sure that the call to getParameter() is returning the truncated value, or is it being lost upon display? For example, if your HTML is ending up like the following:
the browser will not render the field with the full value. if that's the case, you should encode the string upon display. hth, bear [ January 10, 2003: Message edited by: Bear Bibeault ]