Bob,

I see, are you able to modify the servlet thats generating the xml? Can you replace the '&' with an '&' reference? Presumably whatever your using to parse this xml on the client side is reading this invalid. If your using javascript have you tried catching the exception and displaying it?

Gareth

[EMAIL PROTECTED] wrote:
Gareth, you are correct abut ajax being independent.  In my case, the 
interesting thing is that the servlet is using database to look up the data and 
requires where cause as a parameter so that it can generate a query, retrieve 
data from database, create xml to be passed to the calling .jsp page.:
i.e.: here are the steps 1. onchange() getdataValues.jsp?state='NY'
2. in servlet, ( multiple checks...)
 if (state != null && state.length() > 0)
 {
   searchFor = "COUNTRY_ID, COUNTRY_NAME";
   whereIs= "STATE = '" + state + "'";
 }
sql = "SELCT " + searchFor + " FROM DATA_TABLE WHERE " + whereIs; 3. compile data from that query to xml and return to browser. In this case, the database holds the ampersand. not the parameters that are passed to the servlet. When I print out the results that the servlet rturned. It looks like this:
<?xml version="1.0" encoding="UTF-8" ?><root><dataSet dataID="USA" dataValue="United States & US Vargin Islands" 
/><dataSet dataID="AUS" dataValue="Australia" /></root>
The drop down populates when I delete the USA record from the database. So, it seems that the data that is returned needs to be parsed somehow before AJAX can parse and populate the country dropdown. Does this help?


Gareth Evans <[EMAIL PROTECTED]> wrote:
Hi Bob,

Even so, the request that your making to your 'ajax servlet', the url depends on the value of the first select box. Somthing like 'myajaxservlet?firstvalue=Australia'

are you building this url in javascript before making the request? thats the point at which you want to encode it. If you are doing it this way, the servlet will be unable to handle the request as you expected because it will take "United States" and "US Vargin Islands" as separate parameters rather than a single one. Why? because '&' is used as the delimeter. If you use the javascript escape function e.g javascript:escape('United States & US Vargin Islands'), your servlet will handle this as a single parameter.

It doen't matter that your not using struts, ajax is independant of your servlet side code, it could be written in asp if you are that way inclined ;-)

Gareth

                
---------------------------------
 Click here to donate to the Hurricane Katrina relief effort.

--
Gareth Evans

MSoft eSolutions Limited
Technology Centre
Inward Way
Rossmore Business Park
Ellesmere Port
Cheshire
CH65 3EN

--
Tel:    +44 (0)870 0100 704
Fax:    +44 (0)870 9010 705
E-Mail: [EMAIL PROTECTED]
Web:    www.msoft.co.uk

----------------------------------------------
Terms:
Please note that any prices quoted within this e-mail are subject to VAT.
All program details and code described in this e-mail are subject to
copyright © of MSoft eSolutions Limited and remain the intellectual
property of MSoft eSolutions Limited.
Any proposal or pricing information contained within this e-mail are
subject to MSoft eSolutions' Terms and Conditions
----------------------------------------------
Disclaimer:
This message is intended only for use of the addressee. If this message
was sent to you in error, please notify the sender and delete this
message. MSoft eSolutions Limited cannot accept responsibility for viruses,
so please scan attachments. Views expressed in this message do not
necessarily reflect those of MSoft eSolutions Limited who will not
necessarily be bound by its contents.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to