newbie JDBC SP exec
From: homesick_alien (homesick_alien_at_optusnet.com.au)
Date: 03/14/04
- Previous message: bjorn: "sun certified programmer/architect looking for job in zuerich switzerland"
- Next in thread: javamad: "Re: newbie JDBC SP exec"
- Reply: javamad: "Re: newbie JDBC SP exec"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 15 Mar 2004 00:31:34 +1100
Hey There,
Ive been thrown into the deep end at work, ...i" want you to write these
servlets....im assuming you gonna need to learn java..you have two
weeks"...kinda thing....
Im using Velocity and the MVC method...i have a servlet that connects to a
Sybase DB and executes a Stored Procedure, the stored procedure returns a
bunch of records consisting of two columns....
CallableStatement cs = con.prepareCall("{call sp_ml_getglobalfilms}");
ResultSet rs = cs.executeQuery();
while (rs.next()) {
String fid = rs.getString("film_id");
String fname = rs.getString("film_name");
Now how do i add these to "something" ..like array or hashtable? ....that
will hold the two coloums of multiple results.....im not sure if this works
but i just threw a couple of things together
HashMap result = new HashMap();
ArrayList resultList = new ArrayList();
.....
result.put(fidKey,fid);
result.put(fnameKey,fname);
resultList.add(result);
Which then i will have to add to the context in velocity..
ctx.put(fidKey,result.get(fidKey));
ctx.put(fnameKey,result.get(fnameKey));
so the velocity template can iterate over the context and display the
results on a web page...
#foreach ($item in $result)
<tr class="tableData">
<td>$item.get(fidKey)</td>
<td>$item.get(fnameKey)</td>
</tr>
#end
Now what i get is...the ctx isnt displayed onthe webpage.... and im not sure
if all the results are added to the context....or ...?
Can anybody point me in the right direction?
- Previous message: bjorn: "sun certified programmer/architect looking for job in zuerich switzerland"
- Next in thread: javamad: "Re: newbie JDBC SP exec"
- Reply: javamad: "Re: newbie JDBC SP exec"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]