setActionListener takes a MethodBinding which references an
ActionListener, and not an ActionListener directly.   Create a custom
MethodBinding pointing to your PropertyPageListener.

I think I made an example of doing this as an attachment to

http://issues.apache.org/jira/browse/MYFACES-331

On 10/12/05, Marius Kreis <[EMAIL PROTECTED]> wrote:
> I'm trying to dynamically building a list of links whereas each of them
> has an ActionListener.
>
> The code is like this:
>
> while(...) {
>          HtmlCommandLink link = new HtmlCommandLink();
>          link.setValue("link text");
>          link.addActionListener(new PropertyPageListener());
>          panel.getChildren().add(link);
> }
> (PropertyPageListener is implementing the ActionListener interface)
>
> The code is generating the links but when I click on one of them an
> exception is thrown (see bottom of the mail).
>
> Any idea what's going wrong?
> Is is correct to call the method addActionListener with an anonymous object?
>
> - Marius
>
>
>
>     exception
> javax.servlet.ServletException:
> org.apache.myfaces.component.html.ext.HtmlCommandLink
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:109)
> org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
>
>     root cause
> javax.faces.FacesException:
> org.apache.myfaces.component.html.ext.HtmlCommandLink
> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421)
> org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl.dispatch(JspTilesViewHandlerImpl.java:233)
> org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl.renderView(JspTilesViewHandlerImpl.java:219)
> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:330)
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
> org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
>

Reply via email to