3
我想寫一個或多或少的gemeric組件,其中我交入一個控制器bean,並且組件應該顯示一些CRUD按鈕。我可以在複合組件中的bean上調用方法嗎?
下面的複合物成分:
<composite:interface>
<composite:attribute name="controller" />
<composite:attribute name="object" />
</composite:interface>
<composite:implementation>
<h:panelGrid columns="3" columnClasses="celltop">
<h:commandButton id="save" value="#{msg.saveButtonLabel}"
action="#{cc.attrs.controller.save}" />
<h:commandButton id="delete" value="#{msg.deleteButtonLabel}"
action="#{cc.attrs.controller.delete(cc.attrs.object)}" />
<h:commandButton id="cancel" value="#{msg.backButtonLabel}"
action="#{cc.attrs.controller.cancel}" immediate="true" />
</h:panelGrid>
</composite:implementation>
<viewController:buttons controller="customerController" object="#{customerController.customer}"/>
@Named
@ConversationScoped
public class CustomerController implements Serializable {
public String cancel() {
customer = null;
if (!conversation.isTransient()) {
conversation.end();
}
return "cancelled";
}
導致以下情況例外,當我點擊取消按鈕:
javax.faces.el.MethodNotFoundException: javax.el.MethodNotFoundException: /resources/components/viewController/buttons.xhtml @25,65 action="#{cc.attrs.controller.cancel}": Method not found: customerController.cancel()
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:92)
它是不可能的呼籲給予CC豆方法?
eieiei :)再次感謝。 – Joysn 2012-08-16 20:33:49
不客氣。 – BalusC 2012-08-16 20:38:09