Thanx. I didnt see that anywhere...sorry about the ignorant e-mail. I was confused when I saw VTL code accessing properties like that. Guess I cannot get away with lazy coding then :) Bill Boyle GE Capital (TIP/Modspace) -----Original Message----- From: David Esposito [mailto:[EMAIL PROTECTED]] Sent: Friday, June 01, 2001 5:17 PM To: [EMAIL PROTECTED] Subject: RE: Problems accessing object properties You can't do that ... ;) Velocity will not let you access properties (i.e. member variables) of an object, you must use method calls to access the data in your object ... You must modify your EmployeeData class to have a method such as: public String getName(){ return name; } that should do it .. (you can leave your VTL just the way it is and it should work ... Velocity interprets "$Employee.name" as "Look in the Employee object for a method getName() or getname() or get("name")) -Dave > -----Original Message----- > From: Boyle, William (CAP, TIP) [mailto:[EMAIL PROTECTED]] > Sent: Friday, June 01, 2001 5:10 PM > To: '[EMAIL PROTECTED]' > Subject: Problems accessing object properties > > > I know this should be simple, and its actually embarrassing > having to ask for help on something so simple, but as far as I > can tell I am doing everything correctly, and I have > wasted an entire workday already trying different ways to get > this working/reading previous mail posts/reading documentation. > Here is a snippet of my code: > > Java: > public class DisplayQQCustInfo extends VelocityServlet { > public Template handleRequest( Context ctx ) { > ... > EmployeeData ed = session.getEmployee(); > ctx.put("Employee", ed); > ctx.put("testname", ed.name); > try { > Template ret = getTemplate("QQCustInfo.vm"); > ... > return ret; > ... > > Template: > <!-- > 1 > $Employee > 2 > $Employee.name > 3 > $testname > --> > > Output: > <!-- > 1 > EmployeeData@2a15cd > 2 > $Employee.name > 3 > Test1 Test1 > --> > > so from what I can tell, it is finding the "Employee" object, and > in the EmployeeData object I pass in, the name property is not > null and is equal to "Test1 Test1". I have also > tried formal notation ( ${Employee.name} ), with similar > results in the output. I can think of no reason why > $Employee.name would not be recognized. From everything I have read > I am properly passing the object in and properly calling it in my > VTL code. Is there a setting or something that I have missed? > Somebody please help. Sorry if my mail was too > long. > > Bill Boyle > GE Capital (TIP/Modspace)
