9 Replies Latest reply on Nov 10, 2009 8:54 AM by hubaer

    [CDK] Extending a component not working correctly.

      Hi all,

      I have a strange problem, generating JSF components with the CDK. I'm am very new with the CDK, so maybe this is a beginner error :-)

      I wrote a component extending the a4j:commandButton with some more attributes. If I use this component the action method is executed at rendering time in the JSF page, but it should be executed if I click on the button.

      To validate the problem I copied the original cdk a4j:commandButton files into my taglib project. I don't change any line of code, so that is still the same commandButton.
      If I use this copied commandButton in my JSF page, the action is also executed.

      Here a part of my JSF page:

      <a4j:outputPanel id="addItemControls" rendered="#{invoice.editable}">
       <myLib:commandButton action="#{invoice.initLineItem()}"
       reRender="addItemPanel, addItemInput"
       image="/public/media/icons/icon-add.png"
       style="width: 20px;"/>
       </a4j:outputPanel>
      


      Do I have to create my own outputPanel for my components? Did I miss something?

      Any suggestion is welcome.

      Regards
      Marco

        • 1. Re: [CDK] Extending a component not working correctly.
          ilya_shaikovsky

           

          If I use this component the action method is executed at rendering time in the JSF page, but it should be executed if I click on the button.


          not sure that understand completely. please clarify.

          • 2. Re: [CDK] Extending a component not working correctly.

            Don't know correctly how can I clarify this. I try an explaination:

            That is what I expect
            1. I request my html page in my browser.
            2. The JSF page is rendered into an html page.
            3. I see the generated html page in my browser.
            4. I click at my commandButton to nvoke the defined action.

            That is was happens:
            At point 2 the "action" of the commandButton is called, but it should called if I click at point 4 at the button.

            Hoping now it is more clear.

            Regards
            Marco

            • 3. Re: [CDK] Extending a component not working correctly.
              ilya_shaikovsky

              you using seam? maybe the call produced by seam page action call?

              • 4. Re: [CDK] Extending a component not working correctly.

                Hi Ilya,

                yes, this is a Seam application. But I am wondering how the same component code (from RichFaces a4j and from my own taglib) can result in different behaviours?

                How can I check if this is a Seam page action call?

                Regards,
                Marco

                • 5. Re: [CDK] Extending a component not working correctly.
                  ilya_shaikovsky

                  maybe in your pages.xml present something like

                  <pages>
                   <page view-id="/hello.jsp" action="#{helloWorld.sayHello}"/>
                  <pages>
                  

                  or
                  <page action="#{calculator.calculate}">
                  

                  in concrete page file?

                  I do not want to say you made such changes and do not think of them.. but sometimes such changes could be done via some other team member in the same time with your changes and from your point view it will looks like your RF changes effect..

                  If not helps - could you please provide war sample with java sources for examination? (use sendspace.com)

                  • 6. Re: [CDK] Extending a component not working correctly.
                    nbelaevski

                    Hi,

                    This can happen if Facelets tag handler is not working correctly or just missing. Take a look at handler-class element of *.taglib.xml file for your tag.

                    • 7. Re: [CDK] Extending a component not working correctly.

                      Okay I checked the pages.xml. There is no action defined in this file, so this was the wrong way :-(

                      In my component there was no handler-class defined. I added the entry with no effect. The action is still called :-(.

                      The funny / fustrations thing is that the exactly copy of the a4j:commandButton into my own lib doesn't react like the original one from the richfaces lib.

                      I try to create a sample project for this.

                      Regards
                      Marco

                      • 8. Re: [CDK] Extending a component not working correctly.

                        So there are some news. I am trying to build a sample project (using seam-gen). Now a funny thing happens: If I include our component it works as expected.

                        In out large project, we are using Trinidad beside RichFaces and Seam. So I guess it's more a Trinidad problem.

                        Has someone experiences with Trinidad and own compontes build with the CDK?

                        Thanks,
                        Marco

                        • 9. Re: [CDK] Extending a component not working correctly.

                          Okay, I build a sample project with our full configuation (seam, richfaces, trinidad), and build a sample taglib from scratch. As I tried to reproduce the error nothing happens (like in the seam-gen project before). The sample taglib works also perfectly in our real project. So I guess that I have an error in the configuration files for building the component.
                          I can't reproduce the error anymore, but build this component from scratch seems to solve my problem this time.

                          @nbelaevski and ilya_shaikovsky: Thank you very much for your help.

                          Regards
                          Marco