I put the data into beans like you do, but I use a bean declared in a
tag on the jsp and then the iterate tag gets the bean-array direct from
the databean via a getter function.
Some things like options tags are done better like you do, by putting
the bean-array into the request.
There are bound to be even better ways of doing it though.
Adam
Boon Chew wrote:
>Hi, all,
>
>I am creating a typical Master-Detail page which shows a resultset from a
>query.
>
>I am very new to Struts, would like to get your opinion on this to see if
>this is the best way to do things...so say I do a query in a data bean and
>get a resultset back, then I populate each record in the resultset into an
>object. To display those results on a page, I am thinking saving the object
>array in request scope in the action servlet, something like:
>
>Vector userList = new Vector();
>
>...populate userList vector with info from the resultset...
>
>request.setAttribute("userList", userList);
>return (mapping.findForward("showUsers"));
>
>and then in the view JSP showUsers.jsp I use iterate tag to display the
>result, like so:
>
><logic:iterate name="userList" id="users" scope="request" ...>
><tr>
><td>
><bean:write name="users" property="name">
></td>
><td>
><bean:write name="users" property="gender">
></td>
></tr>
></logic:iterate>
>
>Is this the best way to do this sort of stuff in Struts? Thanks for your
>advice.
>
>- boon
>
>
>--
>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>