Flex代码
Hello.jsp的代码如下:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" click="getContent()">
<mx:Script>
<![CDATA[
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import mx.controls.Alert;
//点击舞台调度的函数
private function getContent():void{
var url:URLRequest=new URLRequest("http://127.0.0.1:8080/myapp/Hello.jsp");
var urlLoader:URLLoader=new URLLoader;
urlLoader.load(url);
urlLoader.addEventListener(Event.COMPLETE,loadComplete);
}
//数据加载完成
private function loadComplete(e:Event):void{
Alert.show(e.target.data);
}
]]>
</mx:Script>
</mx:Application>
Hello.jsp的代码如下:
<%@ page language="java" pageEncoding="UTF-8"%>
<%String str="china34420"%>
<%=str%>