Announcement Announcement Module
Collapse
No announcement yet.
Binding a List to an Input Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Binding a List to an Input

    I haven't been able to find any solutions to what I'm sure must be a fairly simple problem. I basically have a set of text inputs that I would like to be populated by a List of Strings. However, I can't seem to nail down the syntax to get the List to bind correctly.

    Right now the JSP looks like:

    Code:
    <form:input path="interests[0]"/>
            <br/>
            <form:input path="interests[1]"/>
            <br/>
            <form:input path="interests[2]"/>
            <br/>
            <form:input path="interests[3]"/>
            <br/>
            <form:input path="interests[4]"/>
    The list property is called interests and has your basic getter and setter. When I try to load this page I get an error saying:
    "No property: 'interests[0]' found". Everything else binds fine. What I am curious about is why OGNL is not parsing the [0] as an index of the item?

  • #2
    does the object in interests[i] have a getter and setter method? If not it won't work.

    If you're using strings use a wrapper class.

    RobH
    Last edited by robhynes; Jul 10th, 2008, 05:08 AM.

    Comment


    • #3
      If this isn't the place for such a rudimentary question, could someone please refer me to the proper place to seek an answer? I certainly haven't found one in the documentation.

      Comment

      Working...
      X