특별한딸기이야기
http로 서버에 정보 전달하기 본문
flex
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
private function onClick() : void
{
setData.send();
}
private function onResult(event : ResultEvent) : void
{
txtResult.text = event.result.toString();
}
private function onFault(event : FaultEvent) : void
{
txtResult.text = event.fault.toString();
}
]]>
</mx:Script>
<mx:HTTPService id="setData" url="http://localhost:8700/setData.jsp" method="GET" result="onResult(event);" fault="onFault(event);" resultFormat="text">
<mx:request xmlns="">
<name>Bard</name>
</mx:request>
</mx:HTTPService>
<mx:Button x="10" y="10" label="send" click="onClick();" id="btnSend" />
<mx:TextArea x="10" y="40" width="344" height="226" id="txtResult" />
</mx:Application>
jsp
<%
String name = request.getParameter("name");
out.println("<h1>Hello" + name + "</h1>");
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
private function onClick() : void
{
setData.send();
}
private function onResult(event : ResultEvent) : void
{
txtResult.text = event.result.toString();
}
private function onFault(event : FaultEvent) : void
{
txtResult.text = event.fault.toString();
}
]]>
</mx:Script>
<mx:HTTPService id="setData" url="http://localhost:8700/setData.jsp" method="GET" result="onResult(event);" fault="onFault(event);" resultFormat="text">
<mx:request xmlns="">
<name>Bard</name>
</mx:request>
</mx:HTTPService>
<mx:Button x="10" y="10" label="send" click="onClick();" id="btnSend" />
<mx:TextArea x="10" y="40" width="344" height="226" id="txtResult" />
</mx:Application>
jsp
<%
String name = request.getParameter("name");
out.println("<h1>Hello" + name + "</h1>");
%>