my guess is that either the getFirstName() method or else the whole
Person class are not declared as public.

Velocity will only give access to public methods in public classes.

On 7/15/07, wong wayne <[EMAIL PROTECTED]> wrote:
Hi all

I'm using spring with velocity to sending email.
Program works fine when those data needed passing in
String type but I cannot access those data member when
passing as an object.

At servlet, object add into hashmap model and added
into VelocityEngineUtil
Person p1 = new Person();
p1.setFirstName(firstName);
p1.setLastName(lastName);
model.put("person", p1);

String text =
VelocityEngineUtils.mergeTemplateIntoString(velocityEngine,
"../template/" + emailContent, "utf-8", model);

At vm file, ${person.firstName} used but it seems
cannot be access. Email received with exact the same
as vm file. I tried to use person.getFirstName to
access but same result.

Any hints would be appreciate, thanks a lot.

regards

wayne




____________________________________________________________________________________
Building a website is a piece of cake. Yahoo! Small Business gives you all the 
tools to get online.
http://smallbusiness.yahoo.com/webhosting
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>
Email Title
</title>
</head>
<body>
<table width="580" border="0" cellspacing="0" cellpadding="0">
<tr>This is a template email testing</tr>
<tr>中文繁�w</tr>
<tr>中文简体</tr>
<tr>Below are attributes pass from servlet</tr>
<tr>First Name: $firstName</tr>
<tr>Middle initial: $middleName</tr>
<tr>Last Name: $lastName</tr>
<tr>Company: $submittedCompany</tr>
<tr>Address: $addline1</tr>
<tr>$addline2</tr>
<tr>$addline3</tr>
<tr>Phone: $phone</tr>
#if ($num == 1)
<tr>Num equals to One</tr>
#end
<tr>${person.firstName}</tr>
</table>
</body>
</html>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to