我正在写一个 JSF 页面,但是,一个命令按钮在页面加载时多次调用它的动作,但没有人点击它......这搞砸了我的整个进度......
HTML:
<h:panelGrid columns="2" cellpadding="10">
<h:form>
<table>
<tr>
<td>姓名:</td>
<td><p:inplace editor="true"><p:inputText value="#{user.name}"/></p:inplace></td>
</tr>
<tr>
<td>联系方式:</td>
<td><p:inplace editor="true"><p:inputText value="#{user.phone}"/></p:inplace></td>
</tr>
<tr>
<td>性别:</td>
<td><h:outputText value="#{user.gender}"/></td>
</tr>
<tr>
<td>身份证号:</td>
<td><p:inplace editor="true"><p:inputText value="#{user.pid}"/></p:inplace></td>
</tr>
<tr>
<td style="position:absolute; right:30px;"><p:commandButton value="删除" action="#{info.removeUser()}"/></td>
</tr>
</table>
</h:form>
爪哇:
public void removeUser(){
System.out.println("Current tab:"+index +" Removed............");
users.remove(Integer.parseInt(index));
}
这里的“索引”是手风琴面板中的当前选项卡,它是一个字符串......
第一次在这里提问,也许我遗漏了一些信息......