Results 1 to 5 of 5

Thread: Problem populating Table data in Spring MVC

  1. #1
    Join Date
    Mar 2012
    Posts
    9

    Default Problem populating Table data in Spring MVC

    Him

    I have a problem populating the data of a table in my jsp into a Set collection. I hav a list of entity objects. Each object has a Set of child objects (Hibernate). My question is, how can I bind a table of these entities?

    I have tried to do it defining varStatus and accessing through index element, but when it tries to populate child object (set collection) an error appears warning that it is not possible to access to a set element [0].
    Code:
    <c:forEach var="listaA" items="${resultsForm.resultList}" varStatus="loopA"> 
    <c:forEach var="item" items="${listaA.cartel}" varStatus="loopCartel"> 
    <form:checkbox path="resultList[${loopA.index}].cartel[${loopCartel.index}].selected" value="true" /> </c:forEach> 
    </c:forEach>
    I think the problem is due to the fact I defined a java.util.Set instead of List, but must of my hibernate hbm's have Set Collections.

    Could anybody help me?

    Thanks. Regards. JB.

  2. #2
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,796

    Default

    Hello

    I have tried to do it defining varStatus and accessing through index element, but when it tries to populate child object (set collection) an error appears warning that it is not possible to access to a set element [0].
    Post the complete error stack trace

    Could you post how you are filling the collections?
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  3. #3
    Join Date
    Mar 2012
    Posts
    9

    Default

    Hi,

    The Set Collection comes from hibernate select.

    The stack trace:

    Invalid property 'resultList[0].cartel[0]' of bean class [com.toroliga.form.SearchResultsForm]: Illegal attempt to get property 'cartel' threw exception; nested exception is org.springframework.beans.InvalidPropertyException : Invalid property 'resultList[0].cartel[0]' of bean class [com.toroliga.form.SearchResultsForm]: Cannot get element with index 0 from Set of size 0, accessed using property path 'cartel[0]'

    Regards.
    JB.

  4. #4
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,796

    Default

    Hello

    The Set Collection comes from hibernate select.
    I want to see such DAO method because in your exception appear this

    Invalid property 'resultList[0].cartel[0]' of bean class [com.toroliga.form.SearchResultsForm]:
    Cannot get element with index 0 from Set of size 0, accessed using property path 'cartel[0]'
    One collection is empty
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  5. #5
    Join Date
    Mar 2012
    Posts
    9

    Default

    Hi,

    The collection it isn't empty, but the index 0 of the collection is null, the object it is on index 10. I think it's due to set properties. If I use List instead Set everything works correctly, so I suppose I can't access through loopCartel.index.

    Is there any else I could do?

    Thanks.
    Regards.
    JB.

Tags for this Thread

Posting Permissions

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