我有一個xp:重複控制與條目列表。對於每個條目我已經定義了一個按鈕,從數據庫中刪除後端文件:函數繼續從重複控制中刪除文檔
<xp:button value="Delete" id="button2">
<i class="fa fa-trash"> </i>
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action>
<![CDATA[#{javascript:employeeBean.remove(obj.unid)}]]>
</xp:this.action>
</xp:eventHandler>
</xp:button>
雖然我注意到一個奇怪的行爲,這工作正常:當我刷新頁面(在瀏覽器F5)我得到一個消息: 確認重新提交表單。如果我選擇確認,則從列表中刪除另一個條目。
只要按F5並刷新頁面,此過程就會繼續。我怎樣才能阻止呢?
Remove方法不是火箭科學:
public void remove(String id) {
try {
Document doc;
openDatabaseAndView();
if (id != null) {
doc = view.getDocumentByKey(id, true);
} else {
doc = null;
}
if (doc != null) {
doc.remove(true);
} else {
//message to user
}
closeDatabaseAndView();
} catch (NotesException e) {
e.printStackTrace();
}
}