You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adam Ruggles <a....@gmail.com> on 2007/06/13 22:55:05 UTC

Unable to submit lists with 2.0.8

My Form looks like this:
<form ...>

<input type="hidden" name="invoices[0].id" value="24907" />
<input type="text" name="invoices[0].salesOrder" value="" />
<input type="hidden" name="invoices[1].id" value="24908" />
<input type="text" name="invoices[1].salesOrder" value="" />
<input type="hidden" name="invoices[2].id" value="24909" />
<input type="text" name="invoices[2].salesOrder" value="" />
...

...
</form>

My Action looks like this

    /**
     * A list of Invoices.
     */
    private List<Invoice> invoices;

    /**
     * Sets invoices.
     * @param invoices The invoices to set.
     */
    public void setInvoices(final List<Invoice> invoices) {
        this.invoices = invoices;
    }

In struts 2.0.6 the form submits and works like expected.  In struts 
2.0.8 I get a null pointer when trying to access invoices in my action 
(basically it's not coming over).  I've changed nothing but the struts.

Was there a change in the way I'm suppose to be submitting a list of 
objects?  How do I fix this?


Thanks,
Adam

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


Re: Unable to submit lists with 2.0.8

Posted by Adam Ruggles <a....@gmail.com>.
Ok it worked again once I added a conversion.properties file to the 
action. 

Why do I need a conversion properties file now? Did some default setting 
change in relation to this?




Adam Ruggles wrote:
> My Form looks like this:
> <form ...>
>
> <input type="hidden" name="invoices[0].id" value="24907" />
> <input type="text" name="invoices[0].salesOrder" value="" />
> <input type="hidden" name="invoices[1].id" value="24908" />
> <input type="text" name="invoices[1].salesOrder" value="" />
> <input type="hidden" name="invoices[2].id" value="24909" />
> <input type="text" name="invoices[2].salesOrder" value="" />
> ...
>
> ...
> </form>
>
> My Action looks like this
>
>    /**
>     * A list of Invoices.
>     */
>    private List<Invoice> invoices;
>
>    /**
>     * Sets invoices.
>     * @param invoices The invoices to set.
>     */
>    public void setInvoices(final List<Invoice> invoices) {
>        this.invoices = invoices;
>    }
>
> In struts 2.0.6 the form submits and works like expected.  In struts 
> 2.0.8 I get a null pointer when trying to access invoices in my action 
> (basically it's not coming over).  I've changed nothing but the struts.
>
> Was there a change in the way I'm suppose to be submitting a list of 
> objects?  How do I fix this?
>
>
> Thanks,
> Adam
>
> ---------------------------------------------------------------------
> 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