How to create a4j.actionparam in java code and tie to a comm
scryan7371 Oct 16, 2007 11:52 AMI am trying to build up a command button in java code and tie action params to it. Since the action param is not a UIcomponent I cannot use the method to add children. How can i recreate the following in java code?
<a4j:outputPanel id="GetNextButton"> <h:panelGroup> <rich:spacer width="40" /> <a4j:commandButton value="#{msgs['HomeView.button.getNext']}" action="#{StepProcessorView.getNext}"> <a4j:actionparam name="selectedBusinessArea" value="#{homeView.selectedBusinessArea}" assignTo="#{StepProcessorView.selectedBusinessArea}" /> <a4j:actionparam name="selectedFunction" value="#{homeView.selectedFunction}" assignTo="#{StepProcessorView.selectedFunction}" /> <a4j:actionparam name="selectedQueue" value="#{homeView.selectedQueue}" assignTo="#{StepProcessorView.selectedQueue}" /> <a4j:actionparam name="selectedWorkType" value="#{homeView.selectedWorkType}" assignTo="#{StepProcessorView.selectedWorkType}" /> <a4j:actionparam name="selectedTransactionType" value="#{homeView.selectedTransactionType}" assignTo="#{StepProcessorView.selectedTransactionType}" /> <a4j:actionparam name="selectedProduct" value="#{homeView.selectedProduct}" assignTo="#{StepProcessorView.selectedProduct}" /> </a4j:commandButton> <h:commandLink> <rich:toolTip value="#{msgs['HomeView.tooltip.getNext']}" direction="top-right" layout="inline" /> <h:graphicImage value="/images/icon_qmark.jpg" width="20" height="20" /> </h:commandLink> </h:panelGroup> </a4j:outputPanel>
and my attempt at java code but since actionparam is not a UIComponent it fails.
// Add the command button HtmlAjaxCommandButton button = new HtmlAjaxCommandButton(); panelGroup.getChildren().add(button); button.setValueBinding("value", FacesContext.getCurrentInstance().getApplication() .createValueBinding("#{msgs['HomeView.button.getNext']}")); Class[] arguments = new Class[0]; button.setAction(FacesContext.getCurrentInstance().getApplication().createMethodBinding( "#{StepProcessorView.getNext}", arguments)); // Add the ajax Support Iterator keys = inComboGroups.keySet().iterator(); while (keys.hasNext()) { String key = (String) keys.next(); ActionParam param = new ActionParam(); param.setAssignToBinding("#{StepProcessorView.selections['" + key + "']}"); param.setValue("#{homeView.selections['" + key + "']}"); button.getChildren().add(param); }