A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: sending a plain variable to recieve xml

  1. #1
    Senior Member RazoRmedia's Avatar
    Join Date
    Oct 2000
    Location
    UK
    Posts
    3,016

    sending a plain variable to recieve xml

    hi

    I'm currently loading an xml doc in using xml.load but I need to send variable torequest this document.

    the xml.sendandload sends and loads XML data whereas the java servlet that will be called needs a simple variable

    can anyone help me with this ?
    Living the dream

  2. #2
    >>SubKloda<<
    Join Date
    Nov 2002
    Location
    Look Behind You
    Posts
    85
    Afternoon Chief,
    using a CDATA section might possibly work... eg:

    returnXML = new XML();
    varXML = new XML("&lt;![CDATA[variable=true]]&gt;");
    varXML.sendAndLoad(url,returnXML);

    otherwise the servlet will have to be modified so that it can accept xml as well as variable input...

    is the variable posted as a parameter to the servlet? if so then you might be able to append the url with the variable and use sendAndLoad with an empty xml doc.

    give us a bell if it doesn't work.

    cheers,
    Andy
    Last edited by Dowapdalilly; 08-21-2003 at 08:47 AM.

  3. #3
    Member
    Join Date
    Jan 2003
    Location
    Australia, Adelaide (SA)
    Posts
    97
    It will depend on how your Java Servlet expects to get it's variable(s), GET or POST.

    If GET (query string) is OK, then it's easy, just add the info to the end of the URL, eg:
    code:

    var strName = "Tim";
    var strURL = "/java/GetDetails.java";
    var xmlDoc = new XML();
    xmlDoc.ignoreWhite = true;
    xmlDoc.onload = myOnLoadHandler;
    xmlDoc.load( strURL + "?name=" + strName );


    If it is expecting a POST then it might be a bit harder, I'm not sure how you could do that, Dowapdalilly's suggestion might work.

    Hope this helps!
    Tim Walters
    Senior Developer
    XML Evangelist
    "XML isn't a language, it's a way of life!"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center