flash与jsp,xml的交互,
//as
on (release) {
var loginData = new LoadVars();
loginData.username = "我发出去去了";
loginData.userpassword = "pp";
loginData.sendAndLoad("http://localhost:8080/index.jsp", loginData, "post");
//不启动浏览器的交互
//loginData.load("http://localhost:8080/url.txt");
loginData.onLoad = function(success:Boolean) {
if (success) {
trace(loginData.username);
trace(loginData.userpassword);
} else {
trace("failed");
}
};
myXML = new XML();
myXML.ignoreWhite = true;//这样就不用怕空白行了!
myXML.load("http://localhost:8080/myxml.xml");
myXML.onLoad = function(success:Boolean) {
//if (success == true) { //同时
//trace(myXML.status);
if (myXML.status == 0) {//检查xml是否正确
trace("XML is successfully loaded");
trace(myXML.childNodes[0].childNodes[1]);
trace(myXML.childNodes[0].childNodes[1].childNodes[0].nodeValue);
} else {
trace("Something is wrong with the XML document");
}
};
}
index.jsp
<%@ page contentType="text/html;charset=UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
String tmp="我传回来了";
out.println("&username="+tmp);//这里一定要写成"&str="的形式,&一定不能少,str的名字要与你a中建的相同,“= ”号也不能少;
//out.print("今天你快乐吗?");
out.println("&userpassword="+"天空");
System.out.println("正在运行中。。。。请勿打扰");
System.out.println(request.getParameter("username"));
//request.setAttribute("app","smile");
%>
myxml.xml
<student>
<name>Thyme</name>
<age>18</age>
<score>
<English>94</English>
<Physics>86</Physics>
<Chemistry>99</Chemistry>
</score>
<grade>B</grade>
</student>
flash与jsp,xml的交互
最新推荐文章于 2024-11-15 19:53:43 发布