My suggestion depended on the method being public.  As it is private,
you should just do:

<td>$shortestTimeBlahBlah</td>

and

map.put("shortestTimeBlahBlah", stats.getShortestTimeBlahBlah());

On Tue, Jul 12, 2011 at 8:48 AM, laredotornado <laredotorn...@gmail.com> wrote:
>
> I tried your suggestion, but still no dice.  I get my object via a singleton
> call, but it still has a public method ...
>
>                final MonitorStatistics stats = 
> MonitorStatistics.getInstance();
>                final Map<String, Object> map = new HashMap<String, Object>();
>                map.put("stats", stats);
>
> the relevant class code is ...
>
> public class MonitorStatistics {
>   /**
>    * instance
>    */
>   private static MonitorStatistics instance = null;
>
>   /**
>    * singleton
>    */
>   public static MonitorStatistics getInstance() {
>      if (null == instance) {
>         instance = new MonitorStatistics();
>      }
>      return instance;
>   }
>
>   /**
>    * Shortest time between leads (in milliseconds)
>    */
>   private Double shortestTimeBetweenLeads;
>
>   ...
>        public Double getShortestTimeBetweenLeads() {
>                return shortestTimeBetweenLeads;
>        }
>
>
> Any other ideas on how to troubleshoot this?  When my emails come through,
> it still appears as, "Shortest Time Between Leads
> $stats.shortestTimeBetweenLeads".
>
>  - Dave
>
>
>
>
> Nathan Bubna wrote:
>>
>> On Tue, Jul 12, 2011 at 5:56 AM, laredotornado <laredotorn...@gmail.com>
>> wrote:
>>>
>>> Hi,
>>>
>>> Using Velocity 1.6.2 with Spring 3.1.  I have a template with lines like
>>> ...
>>>
>>>            <TD>$stats.shortestTimeBetweenLeads</TD>
>>>
>>> and I populate this template using
>>>
>>>                final String emailBody =
>>> VelocityEngineUtils.mergeTemplateIntoString(ve,
>>> template, map);
>>>
>>> so what value do I put in "map"?  What I'm trying right now isn't
>>> working,
>>> which is
>>>
>>>                final Map statsMap = new HashMap();
>>>                stastMap.put("shortestTimeBetweenLeads",
>>> stats.getShortestTimeBetweenLeads());
>>>                final Map<String, Object> map = new HashMap<String,
>>> Object>();
>>>                map.put("stats", map);
>>
>> Why would that work?  You're just putting a map into itself as
>> "stats".  if the class that stats belongs to is public and its
>> getShortestTimeBetweenLeads method is public you can just do:
>>
>> Map map = new HashMap();
>> map.put("stats", stats);
>> String body = VelocityEngineUtils.mergeTemplateIntoString(ve,
>> template, map);
>>
>>
>>> Thanks for any advice, - Dave
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Template-question-tp32045559p32045559.html
>>> Sent from the Velocity - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
>>> For additional commands, e-mail: user-h...@velocity.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
>> For additional commands, e-mail: user-h...@velocity.apache.org
>>
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/Template-question-tp32045559p32046909.html
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
> For additional commands, e-mail: user-h...@velocity.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
For additional commands, e-mail: user-h...@velocity.apache.org

Reply via email to