Struts gurus
 
Help. But allow me to head off any discussion about Struts versions,
etc. It is suffice to say the following: http://struts.apache.org/1.0.2/
is bookmarked by every developer on the team and the application is one
that is highly active and used by millions of users. Upgrading the JAR
and action classes cannot be done at this time. 
 
Laugh if you must, but please help. :)
 
We have a form that has a dynamic number of rows based on the selection
of items on a previous page. The selection updates a boolean field in a
Map keyed by transaction numbers:
 
    key => VO
 
The key is a string that looks like "9876782". The VO object is pretty
standard for a VO... fields, accessors, mutators, etc.
 
The second page of the form looks like this, abridged:
 
Date       Cost       Date of Cost     Type of Cost
 
          +----+      +----------+    
9/3/08    |    |      |          |     0 Personal  0 Business
          +----+      +----------+   
 
          +----+      +----------+    
9/4/08    |    |      |          |     0 Personal  0 Business
          +----+      +----------+   
 
The number of rows are dynamic.
 
So how do I get the Map updated on submit?
 
I'm currently using the logic:iterate tag to some effectiveness but not
on the updating of the Map'd VOs on submit. Here's some code:
 
<logic:present name="transBean">
  <logic:iterate indexId="ctr" id="transItem" name="transBean"
property="transactions"> 
     <bean:define id="item" name="transItem" property="value"
type="com.mysite.transactions.TransVO"/>
      <% boolean checked = item.getIsSelectedTransaction(); %>
     <% bandcount++;
        if(item.getIsSelectedTransaction()) { %>      
      <tr class="<%= (bandcount%2==1 ? "bandcolor" :
"bandcolor2")%>"></p>
      <td class="transaction" align="left" valign="top"><bean:write
name="transItem" property="value.transDate"/></td>
    <td class="transaction" align="left" valign="top"><bean:write
name="transItem" property="value.postDate"/></td>
    <td class="transaction" align="left" valign="top"><bean:write
name="transItem" property="value.description"/></td>
    <td class="transaction" align="left" valign="top"><bean:write
name="transItem" property="value.purchasAmount"/></td>      
    <td class="transaction" align="left" valign="top"
valign="bottom"><bean:write name="transItem" property="value.amount" />
</td>
    <td class="transaction" align="left" valign="top"><bean:write
name="transItem"  property="value.travelDate" /></td>
    <td class="transaction" align="left" valign="top" NOWRAP>    
        <input type="radio" name='<%="transactions[" + ctr +
"].value.transtype"%>' value="B" <%=(checked)?"checked":""%> />    
    <strong>Business</strong> <br />   
    <input type="radio" name='<%="transactions[" + ctr +
"].value.transtype"%>' value="P" <%=(checked)?"checked":""%> />   
    <strong>Personal</strong> </td>  
   </tr>
   <% } %>       
  </logic:iterate>  
</logic:present> 
 
I've looked very closely at the following documentation:
http://struts.apache.org/1.x/struts-taglib/indexedprops.html
 
And I feel I'm very close, but just not quite there. There's a trick
here, and it cannot be the indexed attribute. Remember, v1.0.2 did not
have this support. It was not native until v1.1 (or so it seems) and
updating/patching the jar is not an option at this time.
 
Many Thanks! I look forward to any help on solving this puzzle.
 
Regards,
Tim
 
 
 
 


Barclays             www.barclaycardus.com

This e-mail and any files transmitted with it may contain confidential and/or 
proprietary information. It is intended solely for the use of the individual or 
entity who is the intended recipient. Unauthorized use of this information is 
prohibited. If you have received this in error, please contact the sender by 
replying to this message and delete this material from any system it may be on.

Reply via email to