incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Winer" <awi...@gmail.com>
Subject Re: NullPointer when using dynamic actionListener type
Date Mon, 25 Sep 2006 19:45:14 GMT
tr:forEach only works with other tr: tags - not f:actionListener.

In JSP 2.1 or in Facelets, you can use c:forEach with all tags, but
by the nature of how tr:forEach works, it can't work across all
tags like they can.

-- Adam



On 9/25/06, Döring Markus <Markus.Doering@tcc-products.de> wrote:
> Hello,
> i try to add <f:actionListener /> to <tr:commandButton /> within <tr:forEach>.
> The type of the actionListener is dynamic, so I use an EL-Expression.
> When trinidad adds the actionListener the following exception is thrown:
>
>
>
> 16:25:30,154 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
> java.lang.NullPointerException
>         at org.apache.myfaces.trinidad.component.UIXComponentBase.addFacesListener(UIXComponentBase.java:969)
>         at org.apache.myfaces.trinidad.component.UIXCommand.addActionListener(UIXCommand.java:279)
>         at org.apache.myfaces.taglib.core.ActionListenerTag.doStartTag(ActionListenerTag.java:83)
>
>
>
>
> Here is some of my code:
>
> Test.jspx:
> <tr:forEach var="action" items="#{managedBean.actions}">
>         <tr:commandButton text="#{action}">
>                 <f:actionListener type="#{managedBean.actionMap[action]}" />
>         </tr:commandButton>
> </tr:forEach>
>
> managedBean:
> public class ManagedBean {
>         public List<String> getActions() {
>                 List<String> out = new ArrayList<String>();
>                 out.add("action1");
>                 out.add("action2");
>                 return out;
>         }
>
>         public Map<String, String> getActionMap() {
>                 Map<String, String> out = new HashMap<String, String>();
>                 out.put("action1", Action1.class.getName());
>                 out.put("action2", Action2,class.getName());
>         }
> }
>
> When I use the code without the <f:actionListener> line everything works fine,
the buttons are rendered with the right text
>
> So what's going wrong here? Or is it me doing something wrong?
>
> Greetings
> Markus
>
> PS. I'm using Trinidad M1, MyFaces 1.1.4 and JBoss 4.0.3SP1 with Tomcat 5.5
>

Mime
View raw message