Hi, It is working when i place the code like this in VelocityScreen Class
context.put ("mystudent", new Student("uday","satisfactory")); but when i keep an Collection object i am not getting .. help me Regards, uday -----Original Message----- From: Simon Christian [mailto:[EMAIL PROTECTED] Sent: Thursday, March 31, 2005 8:02 PM To: Velocity Users List Subject: Re: macro help (was need implement like AOP) How are you calling the macro? Is the Student class public? Are there publicly accessible methods getName() and getConduct() on the Student class method? (similarly a generic get(String xxx) would do) - s Uday Kumar wrote: > HI, > > Help me regarding macros > Actually i could not not able to fetch the values which are placed in the > context. > > > > <html> > <body> > #macro (writestudents $studentlist) > #set ($rowcount = 1) > #foreach($student in $studentlist) > #if ($rowcount % 2 == 0) > #set ($bgcolor="#fffff") > > #else > > #set ($bgcolor="#ccccc") > #end > <tr> > /* the problem is here */ > <td bgcolor=$bgcolor">$student.Name</td> > <td bgcolor=$bgcolor">$student.Conduct</td> > /* the problem is here */ > </tr> > #set ($rowcount=$rowcount+1) > #end > #end > > > </body> > </html> > > > I placed in context with the following way: > > Collection students =new ArrayList(); > students.add(new Student("xyz","good")); > students.add(new Student("abc", "bad")); > > > // the context object has already been setup for you! > context.put ("students", students); > > > cheers, > uday > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]