Announcement Announcement Module
Collapse
No announcement yet.
Sub entity access in form submit gives me error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sub entity access in form submit gives me error

    Hello..

    I try to create a form to change an etity and its subentities within one single submit.

    i Access the sub entites like this:

    PHP Code:
    .. normal form stuff
    <c:forEach items="${runreportobject.reportTemplate.reportParameters}var="parameter" varStatus="status">
       <
    form:input path="reportTemplate.reportParameters[${status.index}].value"/>
    </
    c:formEach>

    .. 
    more form stuff 
    The form displays correct and the fields have the correct currenr value. But..

    When i try to submit the form, i get the following error:

    Code:
    org.springframework.beans.InvalidPropertyException: Invalid property 'reportTemplate.reportParameters[0]' of bean class [ch.sisa.reportit.web.controller.impl.functional.dataobjects.RunReportObject]: Illegal attempt to get property 'reportParameters' threw exception; nested exception is 
    org.springframework.beans.InvalidPropertyException: Invalid property 'reportTemplate.reportParameters[0]' of bean class [ch.sisa.reportit.web.controller.impl.functional.dataobjects.RunReportObject]: Cannot get element with index 0 from Set of size 0, accessed using property path 'reportParameters[0]'

    Any idea what could be the cause for this?..

    Thanks in advance

  • #2
    Code:
     Invalid property 'reportTemplate.reportParameters[0]' of bean class 
    [ch.sisa.reportit.web.controller.impl.functional.dataobjects.RunReportObject]: 
    Cannot get element with index 0 from Set of size 0, 
    accessed using property path 'reportParameters[0]'
    Seems the collection is empty, post your POJO definition and how you are filling this object to be used in the view

    Comment


    • #3
      What kind of Set are you using? If its HashSet it wont work, you need an ordered collection or a special editor registered. Try changing to a List or TreeSet and it should work.

      Comment

      Working...
      X