in our project we have a lot of modal panels to ensure that the user knows what he is about to do. all these panels look alike with just two buttons (ok and cancel).
The only difference is the action that the OK-Button is performing.
Now my idea is to build a generic modal panel that I just call and pass the action which is working fine until I need to pass parameters to the action-method.
I am using this as OK-Button:
<a:commandButton
id="okGenericPanel"
action="#{actionBean[action]}"
value="#{messages['wizard.button.ok.label']}"
oncomplete="#{oncomplete}">
</a:commandButton>
which is working fine. Calling this looks like the following:
<a:commandLink id="testLink"
value="#{messages['home.test']}" ajaxSingle="true">
<rich:componentControl for="genericPanel"
attachTo="testLink" operation="show" event="onclick" />
</a:commandLink>
<ui:include src="/components/genericModalPanel.xhtml">
<ui:param name="actionBean" value="#{adminHomeAction}"/>
<ui:param name="action" value="sayHello"/>
<ui:param name="oncomplete" value="alert('im done');" />
</ui:include>
I already tried to give the parameter direclty into the ui:param like this:
<ui:param name="action" value="sayHello('hello')"/>
or in the actual call:
action="#{actionBean[action]('hello')}"
but neither works.
Is there another way to do this? Or is it only possible to call methods without any parameters this way?
thanks a lot for any help, Martin