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]