Hi, all,

while playing with Stripes indexed check box, I hit a wall. 

The scenario is straight forward:
1. step one, retrieve a list of object called "candidates" from the database, 
and put this in flash scope (Attribute name = "candidateListInFlash").
2. step two, display the contents of the  candidate list in a table,  such as 
id and lastName, plus an indexed checkbox for each row.
3. step three, try to capture the checkboxes (the id of the candidates) the 
user clicked. And those values are defined as a list of Long in the action 
class with property name of "selectedCandidates".

    private List<Long> selectedCandidates;
    public List<Long> getSelectedCandidates() {
        return selectedCandidates;
    }
    public void setSelectedCandidates(List<Long> selectedCandidates) {
        this.selectedCandidates = selectedCandidates;
    }

The problem is in step two, in the displaying jsp, with code of:

<s:form beanclass="com.bla.mvc.checkBoxActionBean">
   <table>
      <tr>
        <th>ID</th>
        <th>First name</th>
        <th>Last name</th>
        <th>checkbox</th>
      </tr>
      <c:forEach var="candidate" items="${candidateListInFlash}" 
varStatus="loop"> 
        <tr>        
          <td>          
               <c:out value="${candidate.id}"/>         
          </td>        
          <td><c:out value='${candidate.firstName}'/> </td>
          <td><c:out value='${candidate.lastName}'/> </td>
          <td>                 
                  <s:checkbox name="selectedCandidates" value="${candidate.id}" 
/>
          </td>
        </tr>
      </c:forEach>
    </table>
 <s:submit name="checkBox2"/>
</s:form>

Somhow, in the <s:checkbox name="selectedCandidates" value="${candidate.id}" /> 
statement, the value="${candidate.id}" is never rendered in the jsp. For 
example, in the html source of the jsp, the value for a row of data looks like 
that:
       <tr>        
          <td>110796</td>        
          <td>Dave</td>
          <td>BROWN </td>
          <td>                   
              <input value="${candidate.id}" type="checkbox" 
name="selectedCandidates" />
          </td>
        </tr>

See, the ${candidate.id}
value is never rendered in the checkbox field. I have tried various way, 
nothing is working. By the way, if I put a hard code value such as <s:checkbox 
name="selectedCandidates" value="4" />, the whole things works in hard way.

So value="${candidate.id}"
renders fine in regular jstl tag, but doesn't work inside the stripes checkbox 
tag in indexed property scenario. Is there anything I am missing or should do 
differently? 

Your helps are greatly appreciated.

Lu



_________________________________________________________________
Windows Live Hotmail now works up to 70% faster.
http://windowslive.com/Explore/Hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_faster_112008
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to