webtier@glassfish.java.net

Re: [webtier] Question about Jim Driscoll's Ajax EditText Component Example

From: Lincoln Baxter, III <lincolnbaxter_at_gmail.com>
Date: Sun, 08 Feb 2009 12:30:50 -0500

Good call.

My first thought is that I should probably get a more descriptive
exception, even if I'm using it wrong.
However, I get the same result :( This is what I did... irrelevant parts
excluded.

Bean:

                    public void nameListener(final ActionEvent event)
                    {
                        System.out.println("Listened");
                    }


Consumer:

                <a:editText value="#{viewProjectBean.projectGoals}"
                        submitListener="#{viewProjectBean.nameListener}" />

Component:

                <composite:interface name="editText"
                        displayName="Editable Text Component"
                        shortDescription="Editable Text Component">
                        <composite:attribute name="submitListener"
                targets="submit"
                                required="true"
                                method-signature="void
                f1(javax.faces.event.ActionEvent)" />
                        <composite:attribute name="value" required="true"
                type="String" />
                        <composite:actionSource name="submit" />
                </composite:interface>
                
                <composite:implementation>
                                .....
                                <h:commandButton value="Submit" id="submit"
                
                actionListener="#{compositeComponent.attrs.submitListener}"
                                        onclick="return
                submitButton('#{compositeComponent.clientId}', event);">
                                </h:commandButton>
                                <h:commandButton value="Cancel" id="cancel"
                styleClass="faded"
                                        onclick="return
                cancelButton('#{compositeComponent.clientId}');" />
                                ....
                </composite:implementation>
                
                </html>



On Sun, 2009-02-08 at 08:56 -0800, Jim Driscoll wrote:

>
> To see how to call a listener in a component, see here:
>
> http://weblogs.java.net/blog/driscoll/archive/2008/12/jsf_20_wiring_u_1.html