flex jsp 连接问题

SambaGao 2009-09-26 09:39:27
MyEclipse 上
<?xml version="1.0" encoding="utf-8"?>
<%@ page contentType="text/html;charset=utf-8"%>
<%@ page import="java.sql.*"%>
<phonelist>
<%
String sql = "" ;

try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@100.1.1.13:1521:testnew","xlh","xlh");
Statement stmt = conn.createStatement();
System.out.println("abc") ;
sql = "select username,password from usertable" ;
ResultSet rs = stmt.executeQuery(sql);

while (rs.next()){
out.println("<phone>");
out.println("<name>" + rs.getString("username") + "</name>");
out.println("<pass>" + rs.getString("password") + "</pass>");

out.println("</phone>");
}

rs.close();
stmt.close();
conn.close();

} catch (Exception e) {
out.println(e);
}
%>
</phonelist>
flex builder 上
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" initialize="DataService.send()">

<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;

[Bindable]
var _ArrayConnection:ArrayCollection ;

private function HandlerResult(event:ResultEvent):void {
_ArrayConnection = event.result.phonelist.phone;
}
]]>
</mx:Script>


<mx:HTTPService id="DataService" url="http://localhost:8888/FlexJspDemoTest/index.jsp"
resultFormat="xml" result="HandlerResult(event)" />
<mx:Form>
<mx:FormItem label="用户名:" fontSize="15" >
<mx:TextInput id="username" fontSize="15" text="{_ArrayConnection.getItemAt(0).name}" />
</mx:FormItem>
<mx:FormItem label="密 码:" fontSize="15" >
<mx:TextInput id="password" fontSize="15" text="{_ArrayConnection.getItemAt(0).pass}"/>
</mx:FormItem>
<mx:FormItem>


<mx:Button id="but" fontSize="15" label="确定" />
</mx:FormItem>
</mx:Form>

</mx:Application>
运行后出现
ReferenceError: Error #1069: 在 flash.xml.XMLNode 上找不到属性 phonelist,且没有默认值。
at FlexJspDemo/HandlerResult()[C:\Documents and Settings\Administrator\My Documents\Flex Builder 3\FlexJspDemo\src\FlexJspDemo.mxml:14]
at FlexJspDemo/__DataService_result()[C:\Documents and Settings\Administrator\My Documents\Flex Builder 3\FlexJspDemo\src\FlexJspDemo.mxml:21]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.rpc.http.mxml::HTTPService/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\http\mxml\HTTPService.as:290]
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:193]
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()

何解..是不是哪儿出错了.
...全文
108 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
SambaGao 2009-09-27
  • 打赏
  • 举报
回复
已解决了.
原来可以直接调用.

3,422

社区成员

发帖
与我相关
我的任务
社区描述
其他开发语言 其他开发语言
社区管理员
  • 其他开发语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧