You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Igor Fedulov <if...@outlook.net> on 2001/12/06 19:31:52 UTC
VelocityServlet.error - modification request
Hi guys!
I could be very nice if somebody could change VelocityServlet.error
method just a little bit. When it prints stack trace it's all in one line
in browser view, so if somebody could add html.append("<pre>") before html.append( cause); (line
629 and then add closing "</pre>" before "</body>" (line 636) this could
make reading errors a little easier :)
--
Best regards,
--
HTTP is a stateless protocol, and the Internet is a stateless development
environment
--
Igor Fedulov
E-mail : ifedulov@outlook.net
Work Ph: 773.775.1595
Home Ph: 773.281.8938
Cell Ph: 773.580.5935
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Displaying a recordset
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/6/01 2:35 PM, "Tim Colson" <tc...@cisco.com> wrote:
> Scott -
>
>> Could someone point me in the right direction to information on how to
>> use velocity templates to display a recordset returned by a sql
>> statement.
>
> First place I always look is www.mail-archive.com ... searched for "display
> rows"
>
> (Of course, I've also been on the list for a while and have seen this
> question discussed before, so I new where to poke around. ;-)
>
> http://www.mail-archive.com/velocity-user@jakarta.apache.org/msg01497.html
>
> That link shows an implementation similar to Igor's; however, it uses
> temporary Hashmaps the returned fields can be reference in each row of the
> resultset.
And Rickard had a good suggestion - for the cases where you don't need to be
able to hold onto the Map containing a specific row's data, you can save
memory by making an iterator that wraps a resultset, and returns the same
map over and over for each row...
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
"He who throws mud only loses ground." - Fat Albert
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Displaying a recordset
Posted by Scott Jeppesen <je...@corp.earthlink.net>.
Thank you....that did the trick.
-----Original Message-----
From: Tim Colson [mailto:tcolson@cisco.com]
Sent: Thursday, December 06, 2001 11:36 AM
To: Velocity Users List
Subject: RE: Displaying a recordset
Scott -
> Could someone point me in the right direction to information on how to
> use velocity templates to display a recordset returned by a sql
> statement.
First place I always look is www.mail-archive.com ... searched for
"display
rows"
(Of course, I've also been on the list for a while and have seen this
question discussed before, so I new where to poke around. ;-)
http://www.mail-archive.com/velocity-user@jakarta.apache.org/msg01497.ht
ml
That link shows an implementation similar to Igor's; however, it uses
temporary Hashmaps the returned fields can be reference in each row of
the
resultset.
Cheers,
Timo
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Displaying a recordset
Posted by Tim Colson <tc...@cisco.com>.
Scott -
> Could someone point me in the right direction to information on how to
> use velocity templates to display a recordset returned by a sql
> statement.
First place I always look is www.mail-archive.com ... searched for "display
rows"
(Of course, I've also been on the list for a while and have seen this
question discussed before, so I new where to poke around. ;-)
http://www.mail-archive.com/velocity-user@jakarta.apache.org/msg01497.html
That link shows an implementation similar to Igor's; however, it uses
temporary Hashmaps the returned fields can be reference in each row of the
resultset.
Cheers,
Timo
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Displaying a recordset
Posted by Igor Fedulov <if...@outlook.net>.
> Right but I'm not necessarily just displaying the recordset in a plain
> spreadsheet looking table....I want to have control over where I'm
> showing each column....I have to fit this into a design....
Well you have matrix in hand (List in List) so you could do this:
...
$table.get(<rownum>).get(<columnnum>)
...
I think above just have a potential for ArrayIndexOutOfBoundsException,
but other then that you could jump to any column in any row. Am I missing
something here?
Best regards,
--
HTTP is a stateless protocol, and the Internet is a stateless development
environment
--
Igor Fedulov
E-mail : ifedulov@outlook.net
Work Ph: 773.775.1595
Home Ph: 773.281.8938
Cell Ph: 773.580.5935
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Displaying a recordset
Posted by Scott Jeppesen <je...@corp.earthlink.net>.
Right but I'm not necessarily just displaying the recordset in a plain
spreadsheet looking table....I want to have control over where I'm
showing each column....I have to fit this into a design....
-Scott
-----Original Message-----
From: Igor Fedulov [mailto:ifedulov@outlook.net]
Sent: Thursday, December 06, 2001 11:08 AM
To: Velocity Users List
Subject: Re: Displaying a recordset
> Could someone point me in the right direction to information on how to
> use velocity templates to display a recordset returned by a sql
> statement. I don't need help on actually retrieving the data...I've
done
> that before. And I have no problem displaying a recordset of 1 column
> using a template...however, that's pretty useless.....I want to be
able
> to send a full record set, cycle through the records with a for...each
> and display information from whichever columns I choose. I've tried
> several different things....nothing seems to work. Any help you can
give
> me will be greatly appreciated.
Well something like this:
java.sql.Connection conn =
java.sql.DriverManager.getConnection(blah, blah1, blah2);
java.sql.Statement stmt = conn.createStatement();
java.sql.ResultSet rs = stmt.executeQuery("select column1,
column2 from my_table");
java.util.List table = new java.util.ArrayList();
while(rs.next()) {
java.util.List row = new java.util.ArrayList();
row.add(rs.getObject(1));
row.add(rs.getObject(2));
table.add(row);
}
ctx.put("table", table );
and in template you just do something like this:
#foreach ($row in $table)
<tr>
#foreach ($column in $row)
<td bgcolor="#eeeeee">$column</td>
#end
</tr>
#end
I hope this helps, unless you are dragging huge resultsets over you
should
be fine with above...
Best regards,
--
HTTP is a stateless protocol, and the Internet is a stateless
development
environment
--
Igor Fedulov
E-mail : ifedulov@outlook.net
Work Ph: 773.775.1595
Home Ph: 773.281.8938
Cell Ph: 773.580.5935
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Displaying a recordset
Posted by Igor Fedulov <if...@outlook.net>.
> Could someone point me in the right direction to information on how to
> use velocity templates to display a recordset returned by a sql
> statement. I don't need help on actually retrieving the data...I've done
> that before. And I have no problem displaying a recordset of 1 column
> using a template...however, that's pretty useless.....I want to be able
> to send a full record set, cycle through the records with a for...each
> and display information from whichever columns I choose. I've tried
> several different things....nothing seems to work. Any help you can give
> me will be greatly appreciated.
Well something like this:
java.sql.Connection conn =
java.sql.DriverManager.getConnection(blah, blah1, blah2);
java.sql.Statement stmt = conn.createStatement();
java.sql.ResultSet rs = stmt.executeQuery("select column1,
column2 from my_table");
java.util.List table = new java.util.ArrayList();
while(rs.next()) {
java.util.List row = new java.util.ArrayList();
row.add(rs.getObject(1));
row.add(rs.getObject(2));
table.add(row);
}
ctx.put("table", table );
and in template you just do something like this:
#foreach ($row in $table)
<tr>
#foreach ($column in $row)
<td bgcolor="#eeeeee">$column</td>
#end
</tr>
#end
I hope this helps, unless you are dragging huge resultsets over you should
be fine with above...
Best regards,
--
HTTP is a stateless protocol, and the Internet is a stateless development
environment
--
Igor Fedulov
E-mail : ifedulov@outlook.net
Work Ph: 773.775.1595
Home Ph: 773.281.8938
Cell Ph: 773.580.5935
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Displaying a recordset
Posted by Scott Jeppesen <je...@corp.earthlink.net>.
Could someone point me in the right direction to information on how to
use velocity templates to display a recordset returned by a sql
statement. I don't need help on actually retrieving the data...I've done
that before. And I have no problem displaying a recordset of 1 column
using a template...however, that's pretty useless.....I want to be able
to send a full record set, cycle through the records with a for...each
and display information from whichever columns I choose. I've tried
several different things....nothing seems to work. Any help you can give
me will be greatly appreciated.
-Scott
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: VelocityServlet.error - modification request
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/6/01 1:31 PM, "Igor Fedulov" <if...@outlook.net> wrote:
>
> Hi guys!
>
> I could be very nice if somebody could change VelocityServlet.error
> method just a little bit. When it prints stack trace it's all in one line
> in browser view, so if somebody could add html.append("<pre>") before
> html.append( cause); (line
> 629 and then add closing "</pre>" before "</body>" (line 636) this could
> make reading errors a little easier :)
That's true. You can always just override the method, of course, and do
something nicer :)
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
"Whoever would overthrow the liberty of a nation must begin by subduing the
freeness of speech." - Benjamin Franklin
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>