modal panel buttons
svkap Jul 17, 2010 5:08 PMHello.
I have some problems with my generated model panel buttons. My send button does not call the sendMessage Action method and my Cancel button does not close the model panel.
JSF page:
<f:subview> <rich:modalPanel id="sendMsgPnlPopId" keepVisualState="true" moveable="false" height="240" width="500"> <f:facet name="header"> <h:panelGroup> <h:outputText value="Send Message"></h:outputText> </h:panelGroup> </f:facet> <f:facet name="controls"> <h:panelGroup> <h:graphicImage id="hideMsgPopUplinkId" value="../img/close.png" styleClass="hidelink" /> <rich:componentControl for="sendMsgPnlPopId" attachTo="hideMsgPopUplinkId" operation="hide" event="onclick"/> </h:panelGroup> </f:facet> <a4j:form id="send_message_form_id" binding="#{bean1.sendMessageForm}" /> </rich:modalPanel> </f:subview>
Button initialization:
HtmlAjaxCommandButton sendButton = new HtmlAjaxCommandButton(); sendButton.setId("send_button_id_1"); sendButton.setAjaxSingle(true); sendButton.setType("submit"); sendButton.setValue("Send"); sendButton.setStyleClass("SendMsg_SubmitButton"); sendButton.setReRender(root.getId()); MethodExpression btnSendActionExpression = expressionFactory .createMethodExpression(elContext, "#{sendMessageBean.sendMessage}", null, new Class[] { ActionEvent.class }); MethodExpressionActionListener listenerSend = new MethodExpressionActionListener( btnSendActionExpression); sendButton.addActionListener(listenerSend); sendButton.setOncomplete("if (#{facesContext.maximumSeverity==null}) " + "#{rich:component('sendMsgPnlPopId')}.hide();"); HtmlAjaxCommandButton cancelButton = new HtmlAjaxCommandButton(); cancelButton.setId("cancel_button_id_1"); cancelButton.setAjaxSingle(true); cancelButton.setValue("Cancel"); cancelButton.setStyleClass("SendMsg_SubmitButton"); cancelButton.setOnclick("#{rich:component('sendMsgPnlPopId')}.hide();");
Action:
public void sendMessage(ActionEvent event) { System.out.println("################"); }