You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Samit Goyal <sa...@tatainfotech.com> on 2003/03/05 09:21:29 UTC

How to get Multiple Rows Data in Struts

Hi all,

I am having a JSP which contains 12 rows of editable fields. The each row
contains same type of editable fields.

Now, how shall i handle it in the Form Bean. Shall i create 12 different
fields for each row or can I use Array/List for that.

Will struts set the fields in the Array Object of form bean automatically??

Thanks in Advance.
Regards,
samit


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Populating hidden fields from an iterator

Posted by Karl <ka...@webartjapan.com>.
I'm trying to get struts to generate rows of data with an edit button beside 
each row.  When that edit button is pressed, the record it references will be 
loaded into an edit screen.

The record is referenced by its ID value, which I want to put into a hidden 
field.

I tried doing the following, but it simply places the literal *element.id" as 
the value of the hidden property rather than the value I thought it would 
reference.


<table>
    <tr>
        <th>ID</th>
    </tr>
    <tr>
        <th>Data</th>
    </tr>
    <logic:iterate id="element" name="testForm" property="testData">
        <tr>
            <td>
                <bean:write name="element" property="id"/>
            </td>
            <td>
                <bean:write name="element" property="data"/>
            </td>
            <td>
                <html:form action="do_view_test_data.do" name="testForm" 
type="com.somewhere.TestForm">
                    <html:hidden property="currentId" value="element.id"/>
                    <html:submit value="Edit"/>
                </html:form>
            </td>
        </tr>
    </logic:iterate>
</table>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org