> Do you know of any web sites out there that have any sample source code on
> how to output a table resultset using freemarker ? I've tried searching, but
> couldn't find any.

One way would be to embed the code like the following into your freemarker
servlet. ;-) Of course it uses Village and ECS to make your life easier
though. ;-)


    public void doSelect ( Connection conn, Body body )
        throws Exception
    {
        QueryDataSet qds = null;
        try
        {
            String SQL = "select * from user order by user";
            qds = new QueryDataSet ( conn, SQL );
            qds.fetchRecords();

            Table table = new Table().setWidth("400").setBorder(1);
            for ( int i = 0; i < qds.size(); i++ )
            {
                String username =
qds.getRecord(i).getValue("User").asString();
                String password =
qds.getRecord(i).getValue("Password").asString();

                if ( username == null || username.length() == 0 )
                    continue;
                if ( password == null || password.length() == 0 )
                    password = "empty";

                table.addElement (
                    new TR()
                        .addElement ( new TD().addElement ( "User: " +
username ) )
                        .addElement ( new TD().addElement ( "Password: " +
password ) )
                    );
            }
            body.addElement ( table ).addElement ( new P() );
        }
        finally
        {
            qds.close();
        }
    }

-jon

<http://java.apache.org/ecs/>
<http://www.working-dogs.com/village/>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to