Hi,
I am working on a web project where i need to send scheduled mails.
I am using velocity 1.5 for mail formats.
The velocity configuration i am doing at applicationcontext is,
<bean id="velocityConfig" class="org.springframework.web.servlet.view.veloci ty.VelocityConfigurer">
<property name="resourceLoaderPath">
<value>"/WEB-INF/velocity"</value>
</property>
</bean>
.vm files are placed at /WEB-INF/velocity folder.
In code i am trying
System.out.println("1 :"+Velocity.resourceExists("Hello.vm"));
System.out.println("2 :"+Velocity.resourceExists("/WEB-INF/velocity/Hello.vm"));
System.out.println("3 :"+Velocity.resourceExists("/velocity/Hello.vm"));
System.out.println("4 :"+Velocity.resourceExists("./Hello.vm"));
But everything is returning 'FALSE'.
Even i tried to configure VelocityEngine in applicationcontext like,
<bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEng ineFactoryBean">
<property name="velocityProperties">
<value>
resource.loader=class
class.resource.loader.class=org.apache.velocity.ru ntime.resource.loader.ClasspathResourceLoader
</value>
</property>
</bean>
and then tried code,
@Qualifier("velocityEngine")
private VelocityEngine ve=null;
System.out.println("1 :"+ve.resourceExists("Hello.vm"));
System.out.println("2 :"+ve.resourceExists("/WEB-INF/velocity/Hello.vm"));
System.out.println("3 :"+ve.resourceExists("/velocity/Hello.vm"));
System.out.println("4 :"+ve.resourceExists("./Hello.vm"));
But even this returns 'FALSE'.
I am not getting exactly what i am missing here. Has any one faced this issue earlier and able to resolve?
Thanks,
Samir


Reply With Quote