Results 1 to 3 of 3

Thread: List data binding

  1. #1

    Default List data binding

    Hello
    I got this error during spring controller binding:

    Code:
        org.springframework.beans.InvalidPropertyException: Invalid property 'ingressi[0][id]' of bean class [com.cinebot.bean.json.Ordine]: Property referenced in indexed property path 'ingressi[0][id]' is neither an array nor a List nor a Map; returned value was [1]

    this is the Ordine class

    Code:
        public class Ordine {
        	private List<Ingresso> ingressi=new ArrayList<Ingresso>();
        	private Short puntoVendita;
        	private Integer spettacolo;
        	private Integer[] posti;
        //... getters and setters
        }
    and Ingresso class

    Code:
        public class Ingresso {
        	private String tipo;
        	private Short num;
        	private Integer id;
        	private Integer set;
        //...getters and setters
        }
    and this is what is sended as POST variables:
    Code:
        ingressi[0][id]	1
        ingressi[0][num]	1
        ingressi[0][set]	1
        ingressi[0][tipo]	ingresso
        puntoVendita	1
        spettacolo	24
    I can not understand why this is not working. Have you got some suggestions?
    Thnak you

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    How are you binding? What is being posted is expecting a map as a result, so it appears that your binding is simply wrong (post your jsp). It should send something like ingressi[0].id...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3

    Default

    This post is send by jquery as ajax request of a json object...
    I solved sending raw json instead of form url encoded.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •