Let's say that I want a user to be able to update an invoice with many line 
items on it.  They should be able to make all their quantity updates and hit 
submit.  The abreviated and somewhat simplified HTML might look like this:


  | <form>
  |   <table>
  |     <tr>
  |       <th>Item:</th>
  |       <th>Quantitiy ordered</th>
  |     </tr>
  | 
  |     <tr>
  |       <td>Diet Coke</td>
  |       <td><input name="invoice[0]quantity" type="text" value="5"/></th>
  |     </tr>
  | 
  |     <tr>
  |       <td>Sprite</td>
  |       <td><input name="invoice[1]quantity" type="text" value="2"/></th>
  |     </tr>
  |   </table>
  | 
  |   <input type="submit" value="Update quantities"/>
  | </form>
  | 

I like to use these contructions quite a lot.  I have tried, without success, 
to make something like this work.  The problem is that I'll have a table like 
this:


  |             <h:form>
  |                 <t:dataTable id="invoiceTable"
  |                              var="item"
  |                              value="#{invoice.items}"                       
      
  |                 >
  | 
  |                     <t:column>
  |                         <f:facet name="header">
  |                             <h:outputText value="Item name"/>
  |                         </f:facet>
  |                         <h:outputText value="#{item.name}"/>
  |                     </t:column>
  | 
  |                     <t:column>
  |                         <f:facet name="header">
  |                             <h:outputText value="Quantity"/>
  |                         </f:facet>
  |                         
  |                         <h:inputText value="#{item.quantity}" size="5"/>
  |                         
  |                      </t:column>
  |                  </t:dataTable>
  |                  
  |                 <h:commandButton value="Update invoice" 
action="#{invoiceManager.update}"/>
  |                  
  |             </h:form>
  | 

which of course, does not work, because the inputText value="#{item.quantity}" 
is not actually a value binding because the "item" variable only exists within 
the table iteration (is this correct?)  Is there a way to get this type of 
thing to work?  I'm totally stumped.

Thanks


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991067#3991067

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991067
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to