我需要向用戶確認他或她是否確定要刪除他或她的帳戶。 爲此,我認爲彈出屏幕會很酷。但大多數瀏覽器阻止彈出窗口。如何在富文件中調用託管bean操作:popupPanel
所以我試圖用popupPanel做到這一點。 但我猜這不會是可能的,因爲我有它內部的commandLink,這裏就是我doind至今:
<rich:popupPanel id="popup_delete_profile" modal="true" onmaskclick="#{rich:component('popup_delete_profile')}.hide()">
<f:facet name="header">
<h:outputText value="Aviso" />
</f:facet>
<f:facet name="controls">
<h:outputLink value="#" onclick="#{rich:component('popup_delete_profile')}.hide(); return false;">
Close
</h:outputLink>
</f:facet>
<p>Are you sure ?</p>
<h:commandLink value="Yes" action="#{userc.deleteUser}"></h:commandLink>
<h:outputLink value="#" onclick="#{rich:component('popup_delete_profile')}.hide(); return false;">
No
</h:outputLink>
</rich:popupPanel>
這是我manageBean:
public void deleteUser(){
try {
eaoUser.delete(userb.getUser());
// here I would like to refresh the popupPanel saying that was deleted with success and then logout
} catch (Exception e) {
view.errorMessage("ocorreu um erro, por favor tente novamente");
e.printStackTrace();
}
}
編輯:
public String deleteUser() {
FacesContext.getCurrentInstance().getExternalContext().invalidateSession();
return "/index.xhtml?faces-redirect=true";
}
任何想法如何做到這一點?
那麼,什麼是你的問題是什麼呢?爲什麼你想通過單擊Yes鏈接使用戶的會話失效? – Nikhil 2012-02-10 11:26:08