动态更改分割布局内容GWT

时间:2014-09-21 18:56:33

标签: gwt layout

我想动态更改分割布局内容.. 内容是我从数据库中获取的文本。 因此,当用户在菜单中进行交互并选择一个选项时,它将改变中心的内容。

onModule:

   public void onSuccess(List<BibleTxt> result) 
            {
                int i = 0 ;
                String chapterText ="";

                //chapterText = result.get(1).getVerseText();



                for(i=0;i<50;i++)
                    {
                        chapterText = result.get(i).getVerseText();
                        //Label chapterLabel = new Label(chapterText);
                        p.add(new HTML(chapterText));

                    } 

            }

服务器端:

   public List<BibleTxt> getChapterTxt(int book,int chapter) throws Exception
{
    BibleTxt cText = null;
    List<BibleTxt> chapterTxt  = new ArrayList<BibleTxt>();
    Connection conn = null;
    PreparedStatement pstmt = null;
    ResultSet result = null;

    try{
        conn = getConnection();
        pstmt = conn.prepareStatement("SELECT * FROM bibledb_kjv WHERE BOOKID = ? AND CHAPTERNO =  ?");
        pstmt.setInt(1,book);
        pstmt.setInt(2,chapter);
        result = pstmt.executeQuery();
        //cText = new BibleTxt();
        int i=0;
        while (result.next()) 
            {
                cText = new BibleTxt(result.getInt("BOOKID"), result.getInt("CHAPTERNO"), result.getString("VERSETEXT"));
                chapterTxt.add(i, cText);
            //  ((ResultSet) cText.getChapterList()).next();
                i++;



            }

    }

文本ID除以数据库中的经文。我想要显示第1章第1章的所有经文。

1 个答案:

答案 0 :(得分:0)

我相信p是您的拆分面板。您不能多次使用api p.add()。您必须根据自己的要求使用addEast/West/North/South