小编com*_*ses的帖子

检索数据时,带有ArrayList <SomeClass>的gwt asyncCallback失败

我正在尝试为我的进一步工作制作示例代码.我正在使用gwt vanillia和新的gwt.我的目的是填充一些文本框和网格.从数据库填充文本框,rpc调用没问题.但我不能通过使用RPC调用填充datagrid.我使用Bastian Tenbergen的教程 来填充一些文本框.但是当我尝试使用ArrayList使用异步回调填充网格时,代码失败了.我知道ArrayList也是可序列化的,但我无法解决这个问题.任何建议表示赞赏.这是我的任务的一些代码.在服务器包中:SqlDbConnection.java

    public ArrayList<hastaGrid> callGrid(String something){
    ArrayList<hastaGrid> list = new ArrayList<hastaGrid>();
    hastagrid hastaGrid = null;     
    try {
        Statement st = conn.createStatement();
        ResultSet result = st.executeQuery("select name from TEST where name = '"+ something +"'");

        while(result.next()) {
            hastagrid = new hastaGrid(result.getString(1), result.getString(2),result.getNString(2),result.getString(3));
            list.add(hastaGrid);
            System.out.println("result: " +hastagrid.getLogin().toString()+" " + hastagrid.getPassword() +" "+ hastagrid.getName() +" " + hastagrid.getSurname());
        }
        result.close();
        st.close();                 
    } catch (Exception e) {
        e.printStackTrace();
    }       
    return list;
}
Run Code Online (Sandbox Code Playgroud)

在客户端包中:hastaGrid.java //该类还有getter和setter方法.

public class hastaGrid implements IsSerializable {

private …
Run Code Online (Sandbox Code Playgroud)

gwt rpc asynchronous arraylist callback

0
推荐指数
1
解决办法
2986
查看次数

标签 统计

arraylist ×1

asynchronous ×1

callback ×1

gwt ×1

rpc ×1