[prev in list] [next in list] [prev in thread] [next in thread] 

List:       turbine-torque-user
Subject:    RE: Display of the result
From:       "Göschl,Siegfried" <Siegfried.Goeschl () drei ! com>
Date:       2004-03-22 7:14:23
Message-ID: 90B3A0967470D44CB8FDE74907512328F1CE2B () av1s008 ! at-work ! local
[Download RAW message or body]

Hi Sheng,

since your are using the BasePeer you get a list of 'com.workingdogs.village.Record' \
and not Torque Objects. There should be a 'getValue(String s)' function returning a \
'com.workingdogs.village.Value'

Cheers,

Siegfried Goeschl


-----Original Message-----
From: Sheng Guo [mailto:sheng@in.tum.de]
Sent: Friday, March 19, 2004 9:17 PM
To: torque-user@db.apache.org
Subject: Display of the result


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


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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic