Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsp 动态绑定到动态表组件_Jsp_Jsf_Woodstock - Fatal编程技术网

Jsp 动态绑定到动态表组件

Jsp 动态绑定到动态表组件,jsp,jsf,woodstock,Jsp,Jsf,Woodstock,根据这一点,必须将数据源放到设计器中,才能创建数据提供者。然后动态创建该表并将其绑定到dataprovider 然而,若我的web应用程序充当用户的GUI,那个么用户可以从另一个页面创建表并在另一个页面查看它。由于没有数据提供程序,如何显示/绑定新创建的表 我已经设法做了一点。但是,我不明白为什么我的行组中没有值/数据 ModificationPage.java public class ModificationPage extends AbstractPageBean { @Overr

根据这一点,必须将数据源放到设计器中,才能创建数据提供者。然后动态创建该表并将其绑定到dataprovider

然而,若我的web应用程序充当用户的GUI,那个么用户可以从另一个页面创建表并在另一个页面查看它。由于没有数据提供程序,如何显示/绑定新创建的表

我已经设法做了一点。但是,我不明白为什么我的行组中没有值/数据

ModificationPage.java

public class ModificationPage extends AbstractPageBean {
    @Override
    public void prerender() {
        try {
            tempRowSet.setDataSourceName("java:comp/env/jdbc/testDB_MySQL");
            tempRowSet.setCommand("SELECT * FROM " + this.tempTable.toString());
            tempRowSet.setTableName(this.tempTable.toString());

            tempDataProvider.setCachedRowSet(tempRowSet);
        } catch (SQLException ex) {
            Logger.getLogger(ModificationPage.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void tableID_processValueChange(ValueChangeEvent vce) {
        // Reset the gridpanel so that only the selected table is displayed
        if (gridPanel2.getChildCount() > 1) {
            gridPanel2.getChildren().clear();
        }

        this.tempTable.append(vce.getNewValue());

        Table dynamicTable = new Table();
        dynamicTable.setId(tempTable.toString());
        dynamicTable.setTitle(tempTable.toString());
        dynamicTable.setPaginateButton(true);
        dynamicTable.setPaginationControls(true);

        // Create the Table Row group dynamically
        TableRowGroup rowGroup = new TableRowGroup();
        rowGroup.setId("rowGroup1");
        rowGroup.setSourceVar("currentRow");
        rowGroup.setValueBinding("sourceData", getApplication().
                createValueBinding("#{ModificationPage.tempDataProvider}"));
        rowGroup.setRows(5);

        // Add the table row group to the table as a child
        dynamicTable.getChildren().add(rowGroup);

        int test1 = rowGroup.getChildCount(); // returns 0, why?
        int test2 = rowGroup.getRowCount(); // returns 0, why?
        int test3 = rowGroup.getColumnCount(); // returns 0, why?

        for (int i = 0; i < rowGroup.getRowCount(); i++) {
            // Create the table column
            TableColumn tableColumn = new TableColumn();
            tableColumn.setId(tempRowSet.getColumnNames()[i]);
            tableColumn.setHeaderText(tempRowSet.getColumnNames()[i]);

            // Add the table Column to the table row group
            rowGroup.getChildren().add(tableColumn);

            // Create the Static text and set its value
            StaticText staticText = new StaticText();
            staticText.setValueBinding("text", getApplication().
                    createValueBinding("#{currentRow.value['borrowerID']}"));

            // Add the static text to the table column1
            tableColumn.getChildren().add(staticText);
        }

        gridPanel2.getChildren().add(0, dynamicTable);

    }

}

谢谢。

这不是一个很好的问题。没有密码。你甚至没有在问题中暗示你在使用伍德斯托克。Woodstock已经死了Hi@kolossus,谢谢你向我指出这一点。我目前正在实习,这是我的主管提出的要求。因此,必须使用Woodstock开发此web应用程序。没有代码,因为我还没有编码出来。我目前仍在创建表。其思想是,在另一个页面上,它应该显示新创建的表及其数据。然而,我不确定在运行时如何将数据提供者绑定到表。