Hi Don, Thanks a lot! I'm reading all about OGNL to work with POJOs, and it's interesting.
Thank you again for helping me :) Cheers! -----Mensaje original----- De: Don Brown [mailto:[EMAIL PROTECTED] Enviado el: jueves, 10 de mayo de 2007 22:16 Para: Struts Users Mailing List Asunto: Re: [S2] Using complex objects in JSP All you need to do is expose your TResultSet object via a getter on your Action, then access it like any other object using JSP-EL in your jsp. You can even use the JSTL for-each tag to handle iteration. For example, if you exposed this object using getResultSet(), in your jsp you could access it via ${resultSet} Don On 5/11/07, Jordi Rubio Moreno <[EMAIL PROTECTED]> wrote: > Hi, > > I'm newbie in Struts, and I have begin with Struts 2. I have an > ActionSupport object that contains a complex object TResultSet (this > object communicates with a remote server and this server sends a lot > of information that is stored into the TResultSet client). > > class TResultSet > { > private HashMap data; > > public boolean hasNext(); > public String getField(String key); } > > class A extends ActionSupport > { > public String execute() > { > TResultSet res = new TResultSet(); > > return ActionSupport.SUCCESS; > } > } > > If I was programming with JSP and servlets, I would codify something > like: > > <html> > <body> > <% TResultSet res = request.getAttribute("resultSet"); %> > > <table> > <th> > <td>ID</td> > <td>Name</name> > <td>Url</td> > </th> > <% do { %> > <tr> > <td><% res.getField("ID") %></td> > <td><% res.getField("Name") %></td> > <td><% res.getField("Url") %></td> > </tr> > <% while (res.hasNext()); %> > </table> > </body> > </html> > > How can I do this with Struts 2 without using JSP scripting? I was > thinking on build an array on Strings into the ActionSupport with the > TResultSet data, put it into a member variable of A, and then use > something like iterator tags, but I need to know if Struts is able to > work with complex objects and its funtions. > > Thanks a lot in advance for you time!! > > Cheers! > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]