java - Using stripes indexed properties to populate a map -


hope can me find answer problem that's been keeping me busy 2 days already.

i'm building app making theater-reservations part of java course i've been following.

i'm trying use stripes index feature populate map object using stripes text input fields.

see code below.

jsp:

<c:set var="voorstellingen" value="${actionbean.theater.voorstellingen}" />     <s:form beanclass="theater.action.theateractionbean" method="get">                     <d:table name="${actionbean}">                 <d:column title="naam">                 naam:<s:text name="naam" title="naam" size="30">voer uw naam in</s:text>             </d:column>             <d:column title="telefoon" >                     telefoonnummer:<s:text name="telefoon" title="telefoon"  size="30">voer uw telefoonnummer in</s:text>             </d:column>         </d:table>         <p></p>         <table id="voorstelling">             <thead>                 <tr>                     <th>voorstelling</th>                     <th>datum</th>                     <th>aantal vrij plaatsen</th>                     <th>aantal te reserveren</th>                 </tr>             </thead>             <tbody>                 <c:foreach items="${voorstellingen}" var="voorstelling" >                 <tr>                     <td><c:out value="${voorstelling.naam}" /></td>                       <td><c:out value="${voorstelling.datum.time}" / </td>                     <td><c:out value="${voorstelling.aantalvrij}" /></td>                     <td><c:out value="${voorstelling.id}" /></td>                     <td><s:text name="aantal[${voorstelling.id}]"></s:text>                 </tr>                 </c:foreach>             </tbody>         </table>         <s:submit name="reserveer" value="reserveren"/>     </s:form> 

code above generates table in can put client details, section shows theatre performances , text box in can put number of tickets want order. pressing "reserveer" forwards event handler in actionbean.

following relevant code in actionbean

public class theateractionbean extends baseactionbean {

private static final string formview = "/web-inf/jsp/theater.jsp"; private string naam = null; private string telefoon=null; //private int aantal = 0; private int id = 0; private map<integer,integer> aantal = null;  public string message = null;  ......    public resolution reserveer() throws theaterexception{    message = message +  "telefoon:" + telefoon + "naam:" + naam + "aantalreserveren:" + aantal;    theater theater=getcontext().getcurrenttheater();    if (aantal != null){         iterator = aantal.entryset().iterator();         while (it.hasnext()){             map.entry paar= (map.entry)it.next();             message = message + "key " + paar.getkey() + "value" + paar.getvalue();         }    }    return new forwardresolution(formview); }  ......  public void setaantal(map<integer,integer> aantal){     this.aantal = aantal; } 

reading through other sources

http://www.coderanch.com/t/555416/oa/stripes-nested-indexed-properties-select , https://stripesframework.atlassian.net/wiki/display/stripes/indexed+properties

i'm expecting following

<s:text name="aantal[${voorstelling.id}]"></s:text> 

to map map attribute named aantal in actionbean ik keeps giving null value.

my goal use map process separate reservations each theatre performance using underlying model.

what need work stripes ?

kind regards,

jos

though code examples contain ellipses, may did not implement getter aantal:

public map<integer,integer> getaantal(){     return aantal; } 

not entirely sure it, believe stripes introspects getter on indexed properties in actionbean generic type information binding.


Comments