struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jordi Rubio Moreno" <jru...@grupointercom.com>
Subject [S2] Using complex objects in JSP
Date Thu, 10 May 2007 16:28:36 GMT
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!

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message