3 Replies Latest reply on May 4, 2009 5:06 PM by Tiago Reis

    a:support onclick not working

    Tiago Reis Newbie


      I'm new to SEAM so forgive me if this is isn't the correct place to post this kind of questions, or if I miss on giving some information

      I'm trying to build a jsf page (with ajax) that look like the following:


      <a:repeat id="detail" value="#{bean}" var="temp" >
          <a:support event="onclick" actionListener="#{bean.method}"/>
          <h:graphicImage value="/img.jpg"></h:graphicImage>
          #{temp.name} <br/>


      While the image is rendered ok, the click event doesn't do anything. I wonder if one can use a:support inside a:repeat??

      I'm using SEAM 2.1.1 GA.

      Thanks for any help that you can provide me.

        • 1. Re: a:support onclick not working
          Nikos Paraskevopoulos Novice


          The <a:support> should be nested in a visual component that can emit client-side (Javascript) events. You have nested it within a <a:repeat> (the <div> is NOT a component, it is plain markup for JSF).

          If you want a graphic button that triggers a server-side action, use something like this instead:

          <a:commandButton image="/img.jpg" action="#{bean.method}" />

          Or, to support server interaction for a component that would normally not support it, use (from the RichFaces docs):

          <h:inputText value="#{bean.text}">
              <a4j:support event="onkeyup" reRender="repeater"/>

          But remember the <a:support> allways applies to components (<h:...>, <a:...>, <rich:...> thingies).

          • 2. Re: a:support onclick not working
            Shervin Asgari Master

            I think it is easier to to this instead of having a a:support with onclick. I believe this will work

            <h:commandLink action="#{bean.myAction}">
              <h:graphicImage value="/img.jpg"/>

            If it is not important what is reRendered, I think the a4j or rich package has some commandLink where you can reRender.

            • 3. Re: a:support onclick not working
              Tiago Reis Newbie

              Just wanted to say thanks to both of you for the suggestions.

              Problem solved.