<Posted this once. Didn't see it show up. Trying again. Apologies if it shows 
up twice.>

Craig McC writes:

> Could you refresh us on what your JSP code looks like now?

I've since gone to a datatable. Below is struts-faces and non-struts versions

I did recognize that the nested form bean approach wasn't the optimal way of 
doing once I could put my "real" object into the UI, so I've since modified 
the populating Action to take the objects it gets out of the database and 
stash them into List property (items) of the (Session Scoped, per struts-
config.xml) Dynabean. Still doesn't work any better though. Thinking, "Oh, 
I'm trying to session scope it. Maybe it belongs in faces-config too." didn't 
seem to help.

MaintenanceListForm is the DynaBean which contains a List named "items".

In thinking about it now, it's no great horror to make that one DynaBean 
a "POB". My dependence on DynaBeans came from Struts' need for Form Beans 
with String Properties, and my wanting a fast way to declare them.

One thing I am wondering about (and watch this show all sorts of light on the 
subject) is how is it that JSF knows what actual class "item" is an instance 
of?

JSF snippet:

<h:dataTable value="#{MaintenanceListForm.items}" var="item">

  <h:column>
    <f:facet name="header">
         <h:outputText value="Cost Per Credit"/>
    </f:facet>
    <h:inputHidden id="id" value="#{item.id}"/>
    <h:inputText id="creditCost" value="#{item.creditCost}"/>
  </h:column>
  <h:column>
    <f:facet name="header">
         <h:outputText value="Minimum Purchase"/>
    </f:facet>
    <h:inputText id="minPurchase" value="#{item.minPurchase}"/>
  </h:column>
< <h:column>
    <f:facet name="header">
         <h:outputText value="Currency"/>
    </f:facet>
  <h:selectOneListbox id="currency">
  <f:selectItem itemValue="USD" />
  <f:selectItem itemValue="CAD" />
  <f:selectItem itemValue="EUR" />
  <f:selectItem itemValue="JPY" />
  </h:selectOneListbox>
</h:column>
  <h:column>
    <f:facet name="header">
         <h:outputText value="Begin Date"/>
    </f:facet>
    <h:inputText id="beginDate" value="#{item.beginDate}"/>
  </h:column>
  <h:column>
    <f:facet name="header">
         <h:outputText value="End Date"/>
    </f:facet>
    <h:inputText id="endDate" value="#{item.endDate}"/>
  </h:column>
</h:dataTable>


Struts snippet:

<table border=1 cellpadding=1>
<tr><th colspan="5">Credit Cost Management</th></tr>
<tr>
<th>Cost Per Credit</th>
<th>Minimum Purchase</th>
<th>Currency</th>
<th>Begin Date</th>
<th>End Date</th>
</tr>
<logic:iterate id="items" name="MaintenanceListForm" property="items" 
type="bb.view.CreditCostBean">
<tr><td><html:hidden name="items" property="id" indexed="true" />
<html:text name="items" maxlength="6" size="6" property="creditCost" 
indexed="true" /></td>
<td><html:text name="items" maxlength="6" size="6" property="minPurchase" 
indexed="true" /></td>
<td><html:select name="items" property="currency" indexed="true">
          <html:option value="USD"/>
          <html:option value="CAD" />
          <html:option value="EUR" />
          <html:option value="JPY" />
</html:select>
</td>
<td><html:text name="items" maxlength="10" size="10" property="beginDate" 
indexed="true" /></td>
<td><html:text name="items" maxlength="10" size="10" property="endDate" 
indexed="true" /></td></tr>
</logic:iterate>
</table>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to