Yes I dont see any problems with doing this. You can use my code if you want:
<rich:modalPanel id="popup" width="261" height="386" autosized="true"left="180" top="200" keepVisualState="true">
<h:panelGrid id="panelGrid">
<h:outputText value="#{PopupBean.output}" id="popupMessage"/>
<a4j:commandLink action="#">
<h:outputText value="Close" />
<rich:componentControl for="popup" operation="hide" event="onclick"/>
</a4j:commandLink>
</h:panelGrid>
</rich:modalPanel>
<h:panelGrid columns="2">
<a4j:commandLink action="#" reRender="panelGrid">
<h:outputText value="Yes" />
<rich:componentControl for="popup" operation="show" event="onclick"/>
<a4j:actionparam name="message" assignTo="#{PopupBean.output}" value="#{TestBean.input1}"/>
</a4j:commandLink>
<a4j:commandLink action="#" reRender="panelGrid">
<h:outputText value="No" />
<rich:componentControl for="popup" operation="show" event="onclick"/>
<a4j:actionparam name="message2" assignTo="#{PopupBean.output}" value="#{TestBean.input2}"/>
</a4j:commandLink>
</h:panelGrid>
Basicly the output in the modal panel will contain the values in the TestBean
Edit (the misunderstanding):
I believe you will have to define your modal panel like this:
<rich:modalPanel id="popup" width="261" height="386" autosized="true"left="180" top="200" keepVisualState="true"
binding="#{PopupBean.popupPanel}">
</rich:modalPanel>
And in your managed bean you will have to addChildren to your modal panel dynamically with java like this:
public String action_PoppingThePanel() {
HtmlCommandButton button = new HtmlCommandButton();
button.setValue("Yes");
String action = "#{TestBean.action_yes}";
MethodExpression methodExpression =
FacesContext.getCurrentInstance().getApplication().getExpressionFactory().
createMethodExpression(FacesContext.getCurrentInstance().getELContext(), action, null,
new Class<?>[0]);
button.setActionExpression(methodExpression);
getPopupPanel().getChildren().add(button);
button = new HtmlCommandButton();
button.setValue("No");
String action = "#{TestBean.action_no}";
methodExpression =
FacesContext.getCurrentInstance().getApplication().getExpressionFactory().
createMethodExpression(FacesContext.getCurrentInstance().getELContext(), action, null,
new Class<?>[0]);
button.setActionExpression(methodExpression);
getPopupPanel().getChildren().add(button);
getPopupPanel().setRendered(true);
getPopupPanel().setShowWhenRendered(true);
return null;
}