cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephane Delort" <>
Subject Re: [cforms] struct and class display
Date Thu, 12 Aug 2004 07:41:17 GMT

digging into the below problem, it appears that the null pointer exception
is throwed by the union, and more accuratly its function getValue();

If you look at the API, you will see that :

in the class org.apache.cocoon.forms.formmodel.Union
     public Object getValue()
     Specified by:
     getValue in interface Widget

So, I took a look at the getValue provided by the interface widget and here
is what is writen :

public Object getValue()
the value of the widget. For some widgets (notably ContainerWidgets) this may not make sense,
those should then simply return null here.

As I think the union is kinda ContainerWidget (it belongs to AbstractContainerWidget) and
so, guess it's normal to return null.

Is this correct ?

by the way  I use cocoon 2.1.5 is this fixed (if it has to be) on the CVS ?

Bitte antworten an


Thema:    [cforms] struct and class display


well I can, now, access to the object in class, struct or union in my
     flowscript (see previous thread).

but then, the shame is that it does not display the form and I have a
     "nullpointer exception" error instead.

In my defintion file I have :


   <fd:union id="start" default="" case="widget-id">
     <fd:datatype base="string"/>
       <fd:new id="widgetClass"/>

   <fd:class id="widgetClass">
       <fd:repeater id="inList" >
          <fd:union id="union" case="widget-id">
            <fd:datatype base="string"/>
              <fd:struct id="simpleList">
                 <fd:multivaluefield id="list">


In fill the field thanks to the followwing flowscript :

   var myRepeater = form.lookupWidget("start").lookupWidget("inList");
   var row = myRepeater.addRow();
   var myUnion = row.lookupWidget("union");
   var myDesiredStruct = myUnion.lookupWidget("simpleList");
   var myList = myDesiredStruct.lookupWidget("list");
   myList.setSelectionList( c, "listId", "label" );  //c is an ArrayList


then, finally here is the *template file  which get me into troubles *;

   <ft:union id="start">
       <ft:case id="widgetClass">                     // if I put this
       block in comments, the form is not display but I do not have any
        <ft:new id="widgetClass"/>

     <ft:class id="widgetClass">
       <ft:repeater-widget id="inList">
        <ft:union id="union">

          <ft:case id="simpleList">
            <ft:struct id="simpleList">
              <ft:widget id="list">
               <fi:styling list-type="checkbox"/>


Anyway, it appears that I can fill any field of any structure belonging to
     my union id="union" thanks to the lookupwidget function. So, in this
     case how doesthe union make the selection to know which structure is
     to be displayed ?

Thanks in advance for any help,


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message