Announcement Announcement Module
No announcement yet.
help!!!jsp loop for:each of a map contains <keys: Long, values: List<Long>> Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • help!!!jsp loop for:each of a map contains <keys: Long, values: List<Long>>


    I have a command bean that contains a map coppiePerOffertaMap<Long,List<Long>>(LinkedHashMap ) with set and get method

    I have to build a form: i must iterate for each key map and gets the values for each keys(Lists) and insert them into a select-options. Then i have to send each result of a select to a onsubmit and test what kind of value for each key the
    user have chosen.

    I try in my form (jsp page) to do:

    <c:forEach items="${command.coppiePerOffertaMap}" var="offerta">
    Offerta: <c:out value="${offerta.key}"/>*, <c:out value="${offerta.value}"/>* -> this show me Offerta: 1 , [1, 2, 3] ecc..
    <c:forEach items="${command.coppiePerOffertaMap.value}" varStatus="loopStatus">
    <spring:bind path="command.coppiePerOffertaMap.value[${loopstatus.index}]">
    <option name='<c:out value="${status.expression}"/>' value='<c:out value="${status.value}"/>'>
    <c:out value="${status.value}"/>

    The page display empty select, and spring doesn't give me a stack trace it wrong? why select doesn't contains 1,2,3 values but are empty? Is binding correct(<spring:bind>)?
    I read that "for:each" works only if i iterate trough an iterable collections..but the keys are iterable, the map values (List<Long>) are iterable, right (ListIterator)..uhm values of map?? if right, so why doesn't work??
    please help me..i'm some confused and i'm spring beginners..