0
可能重複:
h:commandLink/h:commandButton is not being invokedJSF命令按鈕沒有按呼叫行動
我必須聲明,就像這樣Command Button
:
<p:panel>
<h:commandButton
id="addBtn"
value="Add"
action="#{createResourceDialogController.add()}"
disabled="#{!createResourceDialogController.enableAddButton}"/>
</p:panel>
</p:dialog>
</h:form>
在`CreateResourceDialogController類,我有一個被稱爲add的函數如下所示:
/**
* Called to handle the upload of the resource.
*/
public void add()
{
Resource resource = new Resource();
resource.setCompanyOwner(getAccount().getCompany());
resource.setCreatedBy(getAccount());
resource.setCreatedOn(new Date());
resource.setLastModified(new Date());
resource.setName(name);
resource.setResourceBinaryList(null);
resource.setUserOwner(getAccount());
setType(resource);
setOwnerType(resource);
setLocation(resource);
setGroups(resource);
createNewResource(resource);
}
我點擊命令按鈕,什麼也沒有發生。我還在添加函數中添加了斷點,並沒有任何反應。我在頁面上有其他的動作監聽器,並且它們都工作正常。有一些關於這個命令按鈕的事情,使它無法工作。
有沒有人有任何想法?