Thanks for your time but what you show me is exactly what I was already
doing .... but inputted changes are NOT being seen in that list when I tried
to post it. That was my question or rather  problem

On Tue, Oct 26, 2010 at 4:32 AM, Li Ying <liying.cn.2...@gmail.com> wrote:

> My way to solve this kind of problem:
>
> (1) Use a DTO class as the data modal for columns of each row.
> Every column is represented by one property of the DTO class.
>
> For example:
> public class Info {
>        private boolean use;
>
>        private String name;
>
>        private int id;
>
>      // getter and setter is omitted
> }
>
>
> (2) In the action class, use a property to represent the rows, and the
> data type of this property is List<DTO> .
>
> For example:
> private List<Info> infoList = new ArrayList<Info>();
> // getter and setter is omitted
> // initialization code is omitted
>
> (3) In JSP, use a <interator> tag on the List, to display rows for
> each DTO instance:
> For example:
>        <s:iterator value="infoList" status="rowStatus">
>                ID: <s:textfield name="infoList[%{#rowStatus.index}].id" />
>                Name: <s:textfield name="infoList[%{#rowStatus.index}].name"
> />
>                <s:checkbox label="Use"
> name="infoList[%{#rowStatus.index}].use"/>
>                <br/>
>        </s:iterator>
>
> The data initialized in action class will be display in your page, and
> the data inputted by user will be applied to the List<DTO> property.
>
>
> I think this is a better design, because the data modal is more
> compliant with OO principles.
>
> Hope this helps.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Reply via email to