3

Jsf 1.2, Richfaces 3.3.3,

I got the following code working to show a richfaces:modalpanel:

<ui:repeat id="albums" var="listvalue" 
    value="#{MyBean.getImagelist()}">
    <a4j:commandLink id="link" reRender="panel">
        <h:graphicImage id="image" url="My_image.jpg"/>
        <rich:componentControl for="panel" attachTo="link" operation="show"
            event="onclick"/>
    </a4j:commandLink>
</ui:repeat>

It works and the modalpanel is shown, but what I couldn't manage to do is call a method that is on MyBean, how do I do that?

UPDATE 1

I forgot to mention that i need to pass a <f:param> on that action

UPDATE 2

As requested, here's the exact code i have:

<ui:repeat id="al11" var="albumslistvalue1" 
value="#{AlbumDetailBean.getAlbumImagesList()}">
  <a4j:commandLink id="link" action="#{AlbumDetailBean.mudaIdatual()}" 
    reRender="panel"
    oncomplete="javascript:Richfaces.showModalPanel('panel');" >
    <a4j:actionparam name="idfotoatual" value="#{albumslistvalue1.id}" />
    <h:graphicImage id="image" 
    url="#{albumslistvalue1.albumimagename}"/>
   </a4j:commandLink>
</ui:repeat>

1 Answers1

2

I suppose you want the action called onclicking the link. I so, try the following:

<a4j:commandLink id="link" action="#{myBean.myAction}" reRender="panel"
    oncomplete="Richfaces.showModalPanel('panel');">
      <a4j:actionparam assignTo="#{yourParam}" value="#{yourParamValue}"/>
    <h:graphicImage id="image" url="My_image.jpg"/>
</a4j:commandLink>

UPDATE: added param as requested.

dcernahoschi
  • 14,968
  • 5
  • 37
  • 59
  • I thought it would work, but the panel doesn't appear and the action isn't called either, also, I edited the question –  Aug 17 '12 at 11:21
  • I've updated the answer. It;s strange that is not working. Do you get any exception? Can you show your exact code? – dcernahoschi Aug 17 '12 at 11:36
  • Still not working, it must be a silly mistake, updating the question with the actual code –  Aug 17 '12 at 11:42
  • 1
    Possible problem? url="{# ...} instead of #{...}/ You also need the assignTo attribute like this: assignTo="#{yourBean.someProperty}" – dcernahoschi Aug 17 '12 at 11:58
  • the url was mistyped, on the code it's right, added assignTo, didn't work. I'm debugging and I can see that the action isn't called at all –  Aug 17 '12 at 12:12