You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Oleg <ol...@gmail.com> on 2005/01/16 02:06:33 UTC

problem submiting List-Backed Indexed ActionForm

I finally got it to display, no problem, however there is an error
when I submit:

java.lang.NullPointerException
       org.apache.commons.beanutils.PropertyUtils.getIndexedProperty

Here is what I got so far.
Struts Version 1.2.4.
 
My FormActionForm includes an ArrayList fields of Bean Field.

FormActionForm:

    public ArrayList getFields() {
      return fields;
    }

  public void setFields(ArrayList fields) {
    this.fields = fields;
  }
....................................................

Field

  private String label;
  private String name;
  private String value;
  private String type;
... with all getters and setters ..........
.......................................................................................
JSP (displays no problem!!):
 <logic-el:iterate name="formActionForm" property="fields" id="foo"
indexId="ctr">
  <tr>
  <td><html-el:text property='<%= "fields[" + ctr + "].label" %>' /></td>
  <td><html-el:text property='<%= "fields[" + ctr + "].value" %>' /></td>
  <td><html-el:checkbox property='<%= "fields[" + ctr + "].required" %>' /></td>
  </tr>
</logic-el:iterate>


Hit the wall here, big time.

Thanks,
Oleg

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: problem submiting List-Backed Indexed ActionForm

Posted by Curtis Taylor <cu...@yahoo.com>.
Hi Oleg,

Have a look here:

http://wiki.apache.org/struts/StrutsCatalogLazyList

I've found these techniques to be invaluable.

HTH,

-- Curtis

Oleg wrote:
> I am initializing ArrayList fields in reset(), but code is ommited.
> I wish it was that easy :)


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: problem submiting List-Backed Indexed ActionForm

Posted by Oleg <ol...@gmail.com>.
Thank you everyone for your help. This page
http://wiki.apache.org/struts/StrutsCatalogLazyList explained the
process very clearly, perfect! Thank you, it works now.

Oleg


On Sun, 16 Jan 2005 10:03:32 -0800, Richard Yee <ry...@cruzio.com> wrote:
> Why don't you send the code in your reset() method so we can see if it is
> correct.
> 
> -Richard
> 
> 
> At 05:51 PM 1/15/2005, you wrote:
> >I am initializing ArrayList fields in reset(), but code is ommited.
> >I wish it was that easy :)
> >
> >
> >On Sat, 15 Jan 2005 19:17:09 -0600, Kishore Senji <ks...@gmail.com> wrote:
> > > Looks like you are not properly initializing your "fields" (ArrayList)
> > >  in FormActionForm. You should initialize it while declaring or in the
> > > reset()
> > >
> > >
> > > On Sat, 15 Jan 2005 17:06:33 -0800, Oleg <ol...@gmail.com> wrote:
> > > > I finally got it to display, no problem, however there is an error
> > > > when I submit:
> > > >
> > > > java.lang.NullPointerException
> > > >       org.apache.commons.beanutils.PropertyUtils.getIndexedProperty
> > > >
> > > > Here is what I got so far.
> > > > Struts Version 1.2.4.
> > > >
> > > > My FormActionForm includes an ArrayList fields of Bean Field.
> > > >
> > > > FormActionForm:
> > > >
> > > >    public ArrayList getFields() {
> > > >      return fields;
> > > >    }
> > > >
> > > >  public void setFields(ArrayList fields) {
> > > >    this.fields = fields;
> > > >  }
> > > > ....................................................
> > > >
> > > > Field
> > > >
> > > >  private String label;
> > > >  private String name;
> > > >  private String value;
> > > >  private String type;
> > > > ... with all getters and setters ..........
> > > >
> > .......................................................................................
> > > > JSP (displays no problem!!):
> > > > <logic-el:iterate name="formActionForm" property="fields" id="foo"
> > > > indexId="ctr">
> > > >  <tr>
> > > >  <td><html-el:text property='<%= "fields[" + ctr + "].label" %>' /></td>
> > > >  <td><html-el:text property='<%= "fields[" + ctr + "].value" %>' /></td>
> > > >  <td><html-el:checkbox property='<%= "fields[" + ctr + "].required"
> > %>' /></td>
> > > >  </tr>
> > > > </logic-el:iterate>
> > > >
> > > > Hit the wall here, big time.
> > > >
> > > > Thanks,
> > > > Oleg
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > > For additional commands, e-mail: user-help@struts.apache.org
> > > >
> > > >
> > >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: problem submiting List-Backed Indexed ActionForm

Posted by Richard Yee <ry...@cruzio.com>.
Why don't you send the code in your reset() method so we can see if it is 
correct.

-Richard


At 05:51 PM 1/15/2005, you wrote:
>I am initializing ArrayList fields in reset(), but code is ommited.
>I wish it was that easy :)
>
>
>On Sat, 15 Jan 2005 19:17:09 -0600, Kishore Senji <ks...@gmail.com> wrote:
> > Looks like you are not properly initializing your "fields" (ArrayList)
> >  in FormActionForm. You should initialize it while declaring or in the
> > reset()
> >
> >
> > On Sat, 15 Jan 2005 17:06:33 -0800, Oleg <ol...@gmail.com> wrote:
> > > I finally got it to display, no problem, however there is an error
> > > when I submit:
> > >
> > > java.lang.NullPointerException
> > >       org.apache.commons.beanutils.PropertyUtils.getIndexedProperty
> > >
> > > Here is what I got so far.
> > > Struts Version 1.2.4.
> > >
> > > My FormActionForm includes an ArrayList fields of Bean Field.
> > >
> > > FormActionForm:
> > >
> > >    public ArrayList getFields() {
> > >      return fields;
> > >    }
> > >
> > >  public void setFields(ArrayList fields) {
> > >    this.fields = fields;
> > >  }
> > > ....................................................
> > >
> > > Field
> > >
> > >  private String label;
> > >  private String name;
> > >  private String value;
> > >  private String type;
> > > ... with all getters and setters ..........
> > > 
> .......................................................................................
> > > JSP (displays no problem!!):
> > > <logic-el:iterate name="formActionForm" property="fields" id="foo"
> > > indexId="ctr">
> > >  <tr>
> > >  <td><html-el:text property='<%= "fields[" + ctr + "].label" %>' /></td>
> > >  <td><html-el:text property='<%= "fields[" + ctr + "].value" %>' /></td>
> > >  <td><html-el:checkbox property='<%= "fields[" + ctr + "].required" 
> %>' /></td>
> > >  </tr>
> > > </logic-el:iterate>
> > >
> > > Hit the wall here, big time.
> > >
> > > Thanks,
> > > Oleg
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> >
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: problem submiting List-Backed Indexed ActionForm

Posted by Oleg <ol...@gmail.com>.
I am initializing ArrayList fields in reset(), but code is ommited.
I wish it was that easy :)


On Sat, 15 Jan 2005 19:17:09 -0600, Kishore Senji <ks...@gmail.com> wrote:
> Looks like you are not properly initializing your "fields" (ArrayList)
>  in FormActionForm. You should initialize it while declaring or in the
> reset()
> 
> 
> On Sat, 15 Jan 2005 17:06:33 -0800, Oleg <ol...@gmail.com> wrote:
> > I finally got it to display, no problem, however there is an error
> > when I submit:
> >
> > java.lang.NullPointerException
> >       org.apache.commons.beanutils.PropertyUtils.getIndexedProperty
> >
> > Here is what I got so far.
> > Struts Version 1.2.4.
> >
> > My FormActionForm includes an ArrayList fields of Bean Field.
> >
> > FormActionForm:
> >
> >    public ArrayList getFields() {
> >      return fields;
> >    }
> >
> >  public void setFields(ArrayList fields) {
> >    this.fields = fields;
> >  }
> > ....................................................
> >
> > Field
> >
> >  private String label;
> >  private String name;
> >  private String value;
> >  private String type;
> > ... with all getters and setters ..........
> > .......................................................................................
> > JSP (displays no problem!!):
> > <logic-el:iterate name="formActionForm" property="fields" id="foo"
> > indexId="ctr">
> >  <tr>
> >  <td><html-el:text property='<%= "fields[" + ctr + "].label" %>' /></td>
> >  <td><html-el:text property='<%= "fields[" + ctr + "].value" %>' /></td>
> >  <td><html-el:checkbox property='<%= "fields[" + ctr + "].required" %>' /></td>
> >  </tr>
> > </logic-el:iterate>
> >
> > Hit the wall here, big time.
> >
> > Thanks,
> > Oleg
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: problem submiting List-Backed Indexed ActionForm

Posted by Kishore Senji <ks...@gmail.com>.
Looks like you are not properly initializing your "fields" (ArrayList)
 in FormActionForm. You should initialize it while declaring or in the
reset()


On Sat, 15 Jan 2005 17:06:33 -0800, Oleg <ol...@gmail.com> wrote:
> I finally got it to display, no problem, however there is an error
> when I submit:
> 
> java.lang.NullPointerException
>       org.apache.commons.beanutils.PropertyUtils.getIndexedProperty
> 
> Here is what I got so far.
> Struts Version 1.2.4.
> 
> My FormActionForm includes an ArrayList fields of Bean Field.
> 
> FormActionForm:
> 
>    public ArrayList getFields() {
>      return fields;
>    }
> 
>  public void setFields(ArrayList fields) {
>    this.fields = fields;
>  }
> ....................................................
> 
> Field
> 
>  private String label;
>  private String name;
>  private String value;
>  private String type;
> ... with all getters and setters ..........
> .......................................................................................
> JSP (displays no problem!!):
> <logic-el:iterate name="formActionForm" property="fields" id="foo"
> indexId="ctr">
>  <tr>
>  <td><html-el:text property='<%= "fields[" + ctr + "].label" %>' /></td>
>  <td><html-el:text property='<%= "fields[" + ctr + "].value" %>' /></td>
>  <td><html-el:checkbox property='<%= "fields[" + ctr + "].required" %>' /></td>
>  </tr>
> </logic-el:iterate>
> 
> Hit the wall here, big time.
> 
> Thanks,
> Oleg
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org