<% @ Page import = "javax. swing. joptionpane "%> <% @ page import =" com. CTL. util. * "%> <% @ page import =" com. CTL. util. test. * "%> <% @ page import =" Java. SQL. * "%> <% @ page Language =" Java "Import =" Java. util. * "pageencoding =" GBK "%> <% string Path = request. getcontextpath (); string basepath = request. getscheme () + ": //" + request. getservername () + ":" + request. getserverport () + path + "/"; %> <! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en"> <HTML>
Ajaxloadxmlres. xml
<? XML version = "1.0" encoding = "GBK"?> <Catalog> <Cd> <title> empire burlesque </title> <artist> Bob Dylan </artist> <country> USA </country> <company> Columbia </company> <price> 10.90 </price> <year> 1985 </year> <person> <ID> 1 </ID> <Name> Zhang San </Name> </person> </Cd> <title> hide your heart </title> <artist> Bonnie Taylor </artist> <country> UK </country> <company> CBS Records </ company> <price> 9.90 </price> <year> 1988 </year> <person> <ID> 2 </ID> <Name> Li Si </Name> </person> </Cd> <title> Greatest Hits </title> <artist> Dolly Parton </artist> <country> USA </country> <company> RCA </ company> <price> 9.90 </price> <year> 1982 </year> <person> <ID> 3 </ID> <Name> Wang Wu </Name> </person> </Cd> <title> still got the blues </title> <artist> Gary Moore </artist> <country> UK </country> <company> virgin records </company> <price> 10.20 </price> <year> 1990 </year> </Cd> <title> Eros </title> <artist> EROS ramazzotti </artist> <country> Eu </country> <company> BMG </company> <price> 9.90 </price> <year> 1997 </year> <person> <ID> 4 </ID> <Name> peerless sword </Name> </person> </Cd> <title> one night only </title> <artist> Bee Gees </artist> <country> UK </country> <company> polydor </company> <price> 10.90 </price> <year> 1998 </year> </Cd> <title> sylvias mother </title> <artist> dr. hook </artist> <country> UK </country> <company> CBS </company> <price> 8.10 </price> <year> 1973 </year> </CD> <Cd> <title> Maggie May </title> <artist> Rod Stewart </artist> <country> UK </country> <company> Pickwick </company> <price> 8.50 </price> <year> 1990 </year> </Cd> <title> romanza </title> <artist> Andrea Bocelli </artist> <country> Eu </country> <company> polydor </company> <price> 10.80 </price> <year> 1996 </year> </Cd> <title> when a man loves a woman </title> <artist> Percy Sledge </artist> <country> USA </country> <company> Atlantic </company> <price> 8.70 </price> <year> 1987 </year> </Cd> <title> black angel </title> <artist> savage rose </artist> <country> Eu </country> <company> mega </company> <price> 10.90 </price> <year> 1995 </year> </Cd> <title> 1999 Grammy nominees </title> <artist> country </artist> <country> USA </country> <company> Grammy </company> <price> 10.20 </price> <year> 1999 </year> </Cd> <title> for the good times </title> <artist> Kenny Rogers </artist> <country> UK </country> <company> mucik master </company> <price> 8.70 </price> <year> 1995 </year> </Cd> <title> Big Willie style </ title> <artist> Will Smith </artist> <country> USA </country> <company> Columbia </company> <price> 9.90 </price> <year> 1997 </year> </Cd> <title> Tupelo honey </title> <artist> Van Morrison </artist> <country> UK </country> <company> polydor </company> <price> 8.20 </price> <year> 1971 </year> </Cd> <title> the very best of </title> <artist> CAT Steven S </artist> <country> UK </country> <company> island </company> <price> 8.90 </price> <year> 1990 </year> </Cd> <title> stop </title> <artist> Sam Brown </artist> <country> UK </country> <company> A and M </Company> <price> 8.90 </price> <year> 1988 </year> </Cd> <title> Bridge of spies </title> <artist> T 'Pau </artist> <country> UK </country> <company> siren </company> <price> 7.90 </price> <year> 1987 </year> </Cd> <Cd> <title> Private Dancer </title> <artist> Tina Turner </artist> <country> UK </country> <company> Capitol </company> <price> 8.90 </price> <year> 1983 </year> </Cd> <title> MIDT om natten </title> <artist> Kim Larsen </artist> <country> Eu </country> <company> medley </company> <price> 7.80 </price> <year> 1983 </year> </Cd> <title> Pavarotti gala concert </title> <artist> Luciano Pavarotti </artist> <country> UK </country> <company> Decca </company> <price> 9.90 </price> <year> 1991 </year> </Cd> <title> the dock of the bay </title> <artist> Otis Redding </artist> <country> USA </country> <company> Atlanta </company> <price> 7.90 </price> <year> 1987 </year> </Cd> <title> picture book </title> <artist> Simply Red </artist> <country> Eu </country> <company> Elektra </company> <price> 7.20 </price> <year> 1985 </year> </Cd> <title> Red </title> <artist> the communards </artist> <country> UK </country> <Company> LONDON </company> <price> 7.80 </price> <year> 1987 </year> </Cd> <title> Unchain My heart </title> <artist> Joe Cocker </artist> <country> USA </country> <company> EMI </company> <price> 8.20 </price> <year> 1987 </year> </Cd> </CATALOG>
Init. js
Function getxhr () {var xhr = NULL; try {xhr = new XMLHttpRequest ();} catch (E) {// Internet assumertry {xhr = new activexobject ("msxml2.xmlhttp");} catch (e) {try {xhr = new activexobject ("Microsoft. XMLHTTP ");} catch (e) {alert (" your browser does not support Ajax! "); Return false ;}}return xhr ;}
Ajax dynamic loading of XML file content