我想将 mxml 文件重定向到 servlet 并在 servlet 上打印代码,但是当我使用导航到 url 代码时,输出显示servlet 页面中 textinput 字段的空值,请帮助我澄清问题 mxml 和 servlet 的基本编码下面给出
MXML 文件
<s:Application...>
<fx:Script>
<![CDATA[
import flash.net.navigateToURL;
import mx.controls.*;
import mx.events.Request;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
public function resultHandler(event : ResultEvent):void
{
navigateToURL(new URLRequest('Srvlt'),'_self')
}
public function faultHandler(event : FaultEvent):void
{
Alert.show("error");
}
]]>
</fx:Script>
<fx:Declarations>
<s:HTTPService id="service" url="Srvlt" result="resultHandler(event)" fault="faultHandler(event)" method="GET" showBusyCursor="true" resultFormat="text">
<s:request xmlns="">
<email>{email.text}</email>
<pass>{pass.text}</pass>
</s:request>
</s:HTTPService>
</fx:Declarations>
<s:VGroup verticalAlign="middle">
<s:FormItem label="E-mail : ">
<s:TextInput id="email" />
</s:FormItem>
<s:FormItem label="Password :">
<s:TextInput id="pass" displayAsPassword="true" />
</s:FormItem>
<mx:Button label="Submit" click="service.send()" />
</s:VGroup>
</s:Application>
servlet的get方法编码如下
String e = request.getParameter("email");
String p = request.getParameter("pass");
String resul;
PrintWriter out = response.getWriter();
resul = "Hi i am servlet, your username is " + e + " & password is " + p + ". are they correct ?";
out.print(resul);