db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sheng Guo <sh...@in.tum.de>
Subject Display of the result
Date Fri, 19 Mar 2004 20:17:15 GMT
Hello,

I used torque to select 3 columns from 2 tables,  the code looks like this:

public List getUsers(){
      java.util.List list = new ArrayList();
      Criteria crit = new Criteria();
      crit.addJoin(SYSContactUserPeer.SYS_CONTACT_ID, SYSContactPeer.ID);
      crit.addSelectColumn(SYSContactUserPeer.FIRSTNAME);
      crit.addSelectColumn(SYSContactUserPeer.LASTNAME);
      crit.addSelectColumn(SYSContactPeer.NAME1);
      crit.addAscendingOrderByColumn(SYSContactUserPeer.ID);

      try {
      
        list = BasePeer.doSelect(crit);
       
        return list;
      }
      catch (Exception exc) {
        String message = exc.toString();
        System.out.println(message);
        return null;

      }

    }

After that I wanted to display the result with Velocity, so:

#set ($users = $badgui.getUsers())   //$badgui.getUsers() is a pulltool 
method I used, to get the result from the Java code
    <center>
       #foreach($user in $users)
        * $user*
       #end
   </center>

then I got  {'Bernadette','Fischer','Bernadette Fischer'} 
{'Eva','Christoph','Christoph-Consult GbR'} in the browser, after that I 
tried

#set ($users = $badgui.getUsers())   //$badgui.getUsers() is a pulltool 
I used, to get the result from the Java code
    <center>
       #foreach($user in $users)
        * $user.firstname*
       #end
   </center>

but I got  $user.firstname instead of the first item from each record.  
How can I get the desired items instead of the variables?

Thanks for any advice!

yours sincerely

Guo


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message