'%' is used to refer to characters by value, e.g. %20 is a space char. Hence, you need to ensure your parameter values are URL encoded or the URL will get screwed up. If you have an HTML form, such as:
<form name="theForm" action="myurl" method="post" enctype="multipart/form-data"> ... </form> then the browser should take care of URL encoding all parameter values that you enter through form input fields. This will ensure that '%' is appropriately escaped. However, you need to be careful if your form isn't submitted 'directly'. For example, your page could have JavaScript coded so that when you perform some action (e.g. click a button) it builds up a URL with a query string consisting of the name/value pairs of all the input fields contained in theForm then navigates the browser to this new URL. If you do something like this, then your JavaScript must explicitly URL encode the parameter values (and names, if necessary) before appending them to the new URL string. Regards, Al. > -----Original Message----- > From: Witold Iwaniec [mailto:[EMAIL PROTECTED]] > Sent: 28 May 2002 16:10 > To: JDJList > Subject: [jdjlist] Servlet Request parameters and % > > > Hi all > > In my servlet application I need to allow users to use wildcards in > queries. The Oracle wildcard character is the "%" so e.g. in the user > could type street name as: "Uni%" instead of "University" > But if I use the "%", the URL parameters get messed up. For example > if I have on my page textboxes STREET_NO and STREET_NAME and > fill: > STREET_NO: 2% > STREET_NAME: UNI% > > in the request URL I don't see STRETE_NO and STREET_NAME > appears as: 2 TREET_NAME with unprintable character. > Sometimes the value is changed. > > I believe the "%" has special use in servlet > request/response. I guess I > could change the wildcard to a "*" or something else. But wonder if > there is a way to handle the % properly > > Thanks > > Witold > > ================================== > Witold Iwaniec > Sr Software Developer > NovaLIS Technologies > [EMAIL PROTECTED] > http://www.novalistech.com > > > To change your membership options, refer to: > http://www.sys-con.com/java/list.cfm > To change your membership options, refer to: http://www.sys-con.com/java/list.cfm
