Flex Óà POST Ìá½»Êý¾Ý
public function submit():void{
//ÒªÇëÇóµÄURL
var request:URLRequest = new URLRequest("
http://localhost:8086/test.do
") ;
var load:URLLoader = new URLLoader() ;
//URL²ÎÊý
var variables:URLVariables = new URLVariables();
//variables.+ºóÃæµÄ²ÎÊý ±íʾҪÌá½»µÄ²ÎÊý¡£
variables.content = content.text;
variables.no = 1001 ;
//Ìá½»µÄ·½Ê½
request.method=URLRequestMethod.POST;
//Ìá½»µÄÊý¾Ý
request.data=variables ;
load.dataFormat = URLLoaderDataFormat.TEXT ;
load.load(request) ;
}
ºǫ́ͨ¹ý£º
String content = request.getParameter("content") »ñÈ¡£»
String no = request.getParameter("no ") »ñÈ¡£»
Ïà¹ØÎĵµ£º
Flex ÖеÄStates(״̬)
¹Ø¼ü×Ö: flex, states
States ÊÇÒ»Ì×ÓÃÓÚ´´½¨×´Ì¬×é¼þµÄÇ¿´ó¹¤¾ß£¬Ò²¾ÍÊÇ˵×é¼þ¿ÉÒÔÓжà¸öÊÓͼ¡£
ʹÓÃStates À´Çл»ÊÓͼ¿ÉÒÔ½ÚÔ¼×ÊÔ´
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:states> ......
flex ºÍjavascript»¥Ïàµ÷Óá£
Ò»¡¢flex µ÷ÓÃjavascript
Ö»ÐèʹÓþ²Ì¬µÄExternalInterface.call¾Í¿ÉÒÔÁË¡£
call ·½·¨ÖÁÉÙÒªÇóÒ»¸ö²ÎÊý£¬¾ÍËùµ÷ÓöÊýµÄÃû³Æ¡£
Ò²¿ÉÒÔ´«µÝ²ÎÊý¡£
È磺
ExternalInterface.call("alert","hello");
"hello"¾ÍÊÇ×÷Ϊalertµ ......
flex Ôڳɳ¤µÄ¹ý³ÌÖÐÀú¾²×É££¬µ«ÊÇʼÖÕÀë²»¿ªflashÔÚºǫ́×öºó¶Ü£¬ËûµÄºǫ́´úÂëÊÇActionscirp µ«ÊÇsliverlightµÄºǫ́´úÂëÊÇ.net µÄ¼¼Êõ ËùÒÔ˵slilverlightѧµÄʱºò£¬Ö»ÒªÄã»á.net¾Í¿ÉÒԷdz£¿ìµÄÉÏÊÖ£¬flex ÄãÒÔǰѧ¹ýflash¡£ÄãÒ²¿ÉÒԺܿìÉÏÊÖ ......
1.д session
mxml Îļþ ¼Ó
<mx:RemoteObject source="servlet" id="sessionObject" />
as ÎļþÓÃÏÂÃæÓï¾äµ÷ÓÃ
sessionObject.session("set", "foo", 30200);
2.¶Á session
mxml Îļþ ¼Ó
<mx:RemoteObject source="servlet" id="sessionObject1" res ......
½«FlexÓëSpring¼¯³Éºó£¨BlazeDS ÓëSpring¼¯³ÉÖ¸ÄÏ £©£¬µÚÒ»¸öÃæÁÙµÄÎÊÌâ¾ÍÊÇ£º¶ÔÓÚJava¶Ë·µ»ØµÄ¸÷ÖÖJavaÀàÐ͵ĶÔÏó£¬FlexÖÐÄÜ·ñÓÐÏàÓ¦µÄÊý¾ÝÀàÐÍÀ´Ó³Éä¡£
´¦Àí£¬ÓÈÆäÊÇList¡¢Set¡¢Map¼°POJO¶ÔÏóÖµ¡£
ÔÚ BlazeDS ÓëSpring¼¯³ÉÖ¸ÄÏ Àý×ӵĻù´¡ÉÏ£¬µ÷ÕûÏà¹ØµÄ²âÊÔ´úÂëÈçÏ£º
1¡¢Java¶Ë
1.1¡¢com.yeeach.HelloWorldService ......