无法从 Flexbuider 3 运行 .jsp url?
以下是应在 URL http://localhost:8084 后面运行的 .mxml
代码/HelloWorld/index.jsp:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:maps="com.google.maps.*"
viewSourceURL="srcview/index.html">
<mx:HTTPService id="srv" url="http://localhost:8084/HelloWorld/index.jsp" />
<mx:Button label="Get Data" click="srv.send()"/>
<mx:Button label="Print" click="creationCompleteHandler(event)"/>
<mx:Script>
<![CDATA[
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.utils.ByteArray;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.TextArea;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.xml.SimpleXMLDecoder;
import mx.utils.ObjectUtil;
import mx.utils.XMLUtil;
protected function creationCompleteHandler(event:Event):void
{
//http://localhost:8084/GetShapeFiles/
Alert.show("Here comes data: ");
}
]]>
</mx:Script>
</mx:Application>
当我在浏览器上打开URL时,它正在打开但无法通过.mxml
运行。我收到错误:
[RPC Fault faultString="Error #1096: XML parser failure: Unterminated element." faultCode="Client.CouldNotDecode" faultDetail="null"]
at mx.rpc.http::HTTPService/http://www.adobe.com/2006/flex/mx/internal::processResult()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\http\HTTPService.as:851]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:188]
at mx.rpc::Responder/result()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:43]
at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:74]
at DirectHTTPMessageResponder/completeHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:403]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
Following is a .mxml
code that should run behind URL http://localhost:8084/HelloWorld/index.jsp:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:maps="com.google.maps.*"
viewSourceURL="srcview/index.html">
<mx:HTTPService id="srv" url="http://localhost:8084/HelloWorld/index.jsp" />
<mx:Button label="Get Data" click="srv.send()"/>
<mx:Button label="Print" click="creationCompleteHandler(event)"/>
<mx:Script>
<![CDATA[
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.utils.ByteArray;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.TextArea;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.xml.SimpleXMLDecoder;
import mx.utils.ObjectUtil;
import mx.utils.XMLUtil;
protected function creationCompleteHandler(event:Event):void
{
//http://localhost:8084/GetShapeFiles/
Alert.show("Here comes data: ");
}
]]>
</mx:Script>
</mx:Application>
When I open the URL on browser, it is opening but not able to run through .mxml
. I get an error:
[RPC Fault faultString="Error #1096: XML parser failure: Unterminated element." faultCode="Client.CouldNotDecode" faultDetail="null"]
at mx.rpc.http::HTTPService/http://www.adobe.com/2006/flex/mx/internal::processResult()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\http\HTTPService.as:851]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:188]
at mx.rpc::Responder/result()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:43]
at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:74]
at DirectHTTPMessageResponder/completeHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:403]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这个错误是不言自明的。您返回的 XML 无法解析,可能是因为它的格式不正确。可能是您的 jsp 没有发送正确的 xml,或者您的服务器不理解 jsp,只是将其作为纯文本返回给 Flex。
我也不明白你是如何使用这个 xml 的。因为我只看到“获取数据”和“打印”按钮,它们与返回的结果无关。
I think the error is pretty self-explanatory. Your returned XML is not parsable probably because it's not formatted properly. Could be that your jsp isn't sending good xml or that your server doesn't understand jsp and just returns it as plain-text to Flex.
I'm also failing to see how you're using this xml. Since I only see a 'get data' and a 'print' button that never relates to the result being returned.