Thanks folks!

Has anyone used the struts-layout library from Improve?

Sunil

-----Original Message-----
From: Keith Bacon [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 17, 2001 3:29 AM
To: Struts Users Mailing List
Subject: RE: example for displaying tables?


Sorry if I'm off the mark here but I think,

1 - Change your iterate tag so name="myTestForm"
The iterate tag will the look for a bean named
myTestForm.

2 - In your action class create that bean:-
request.addAttribute("myTestForm", new TestForm());

keith.







--- "Cuperus, Bob" <[EMAIL PROTECTED]> wrote:
> Hello:
>
> Whatever is inside the iterate will be replicated on
> each iterate.  Here's
> an example that might work for you...but it really
> depends on what you are
> looking for when the data is output.
>
> <table cellpadding="0" cellspacing="0" border="1"
> width="95%"
> align="center">
>       <tr>
>               <td> This is my data</td>
>       </tr>
> <logic:iterate id="row" name="TestForm"
> property="grid">
>       <tr>
>               <td><bean:write name="row" property="value"/></td>
>       </tr>
> </logic:iterate>
> </table>
>
> You could also get more complex by using multiple
> interates to display
> header information and data.  But again, it depends
> on what type of data you
> have and how you want it displayed.
>
> Hope this helps.
>
> Bob
> -----Original Message-----
> From: Sunil Mandya [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, December 16, 2000 11:52 PM
> To: Struts Users Mailing List
> Subject: example for displaying tables?
>
>
> Hi everyone,
> Is there an eaxmple out there for displaying table
> data?
> How do I use iterate? With the code below, it just
> prints Next element is
> Thanks for any help.
> Sunil
>
> Here's my jsp:
> Test.jsp:
>
> <html>
> <body>
> <html:form
>   <table>
> <logic:iterate id="row" name="TestForm"
> property="grid">
> Next element is <bean:write name="row"
> property="value"/>
> </logic:iterate>
>   </table>
>   <html:submit/>
> </html:form>
> </body>
> </html>
>
> My Form:
> TestForm
> public class TestForm extends ActionForm
> {
>
>   private Vector grid = new Vector();
>
>    public TestForm() {
>
>         // Create the Grid
>         for (int i = 0; i < 3; i++) {
>             //Create a row
>             grid.add(new Row("key", "Cell (1)"));
>             grid.add(new Row("key","Cell (2)"));
>             grid.add( new Row("key","Cell (3)"));
>
>         }
>    }
>
>
>
>    /**
>     * Return the grid
>     */
>    public Vector getGrid() {
>       return grid;
>    }
>
> }
> The Row class:
> public class Row
>    {
>     private String key = null;
>     private String value = null;
>
>     public String getKey()
>     {
>       return key;
>     }
>     public String getValue()
>     {
>       return value;
>     }
>     public Row(String key, String value)
>     {
>       key = key;
>       value = value;
>     }
> }
>
> The Action class:
> public class TestAction
> {
>       public ActionForward perform(ActionMapping
> mapping,
>                                ActionForm form,
>                                HttpServletRequest request,
>                                HttpServletResponse response)
>       throws IOException, ServletException {
>
>       // Validate the request parameters specified by the
> user
>       ActionErrors errors = new ActionErrors();
>       return (mapping.findForward("success")); //success
> maps back to
> test.jsp
>
>     }
>
> }
>
>
>
_________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at
> http://mail.yahoo.com
>
>
> --
> 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]>
>


__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

--
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]>

Reply via email to