使用 netui 转发器创建锚点数组后,我如何调用一个方法来获取锚点 ID 并执行查询

After creating an array of anchors using netui repeater how do I call a method which will take the anchor id and execute a query

最初我在页面流变量 a 中加载查询结果(select * 来自 table_name)。查询 returns 一个数组,现在对于数组中返回的每个对象,我使用 netui-data repeater 添加了锚点。我保留了一个锚点以从数据库中删除该对象,但是我不知道该怎么做。

这是 jsp 的表格,代码为

<netui:form action="load_answer_main">
<netui:anchor action="add_bot" value="Add Bot"/>
<table id="t4" class="example table-autosort table-autofilter table-autopage:20000 table-page-number:t4page table-page-count:t4pages table-filtered-rowcount:t4filtercount table-rowcount:t4allcount">
        <tr><td>Answer Bot Name</td> <td>Utterances</td> <td>Type</td> <td>Action</td>
        </tr>
        <netui-data:repeater dataSource="pageFlow.a"> 
        <netui-data:repeaterItem>
        <tbody>
            <tr>
            <td style="font-weight:bold;font-size:16px;">   <netui:label value="${container.item.bot_name}" /> </td>            
            <td style="font-weight:bold;font-size:16px;">   <netui:label value="${container.item.utterances}" /> </td>
            <td style="font-weight:bold;font-size:16px;">   <netui:label value="${container.item.bot_type}" /> </td>
            <td> <netui:anchor value="Delete Bot" action="delete_bot" tagId="${container.item.id}"/></td>
            </tr>
            </netui-data:repeaterItem>
            </netui-data:repeater>
        </tbody>
    </table>
</netui:form>

这是我要调用的控制器方法,其中应从 jsp 传递 id。

public Forward delete_bot(AnswerForm form){ 
        //TODO Pass ID in the delete action
        try {
            ma.deleteAnswerBot(id);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return new Forward("home");
    }

我正在使用 Oracle Workshop for Weblogic 作为我的 IDE。

感谢任何意见或建议。

所以基本上我们需要在 jsp 中设置一个参数 say id 可以设置为数据库中的 id。

<netui-data:repeater dataSource="pageFlow.ld">
<netui-data:repeaterItem>
<netui:anchor value="${container.item.rd.name}" action="getCharts">
<netui:parameter name="id" value="${container.item.rd.id}"/>
</netui:anchor>
</netui-data:repeaterItem>
</netui-data:repeater>

然后在controller中我们可以在request中访问这个参数

int request_source = Integer.parseInt(this.getRequest().getParameter("id"));