velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amit Jagtap <amit.jag...@gmail.com>
Subject Re: Error in intializing Velocity for StringResourceLoader
Date Sat, 28 Jun 2008 14:16:08 GMT

Hi,

the mentioned issue got resolved..
had to add the following-
            VelocityEngine ve = new VelocityEngine();
            Properties p = new Properties();
            p.setProperty( "resource.loader", "string" );
            p.setProperty( "string.resource.loader.description", "Velocity
StringResource loader" );
            p.setProperty( "string.resource.loader.class",
"org.apache.velocity.runtime.resource.loader.StringResourceLoader" );
            ve.init(p);


it was given in the javadoc :P
the age old unix adage is true till date - "RTFM" :)

Thanks,
Amit



Amit Jagtap wrote:
> 
> I am trying to invoke Velocity using following code-
> 
> VelocityEngine ve = new VelocityEngine();
> 
> Properties p = new Properties();
> p.setProperty( "resource.loader", "String" );
> p.setProperty( "class.resource.loader.class",
> "org.apache.velocity.runtime.resource.loader.StringResourceLoader" );        
> 
> ve.init(p);
> 
> VelocityContext context = new VelocityContext();
> 
> 
> I am trying to do the above after reading javadoc for
> ClasspathResourceLoader. the javadoc says-
> resource.loader = class class.resource.loader.class =
> org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader 
> should be used. I tried these properties and my templates are loaded from
> classpath.
> 
> But now I need to create my templates dynamically. For this I am using
> StringResourceLoader. But after the above mentioned initialization of
> Velocity, I get following error-
> WARNING: ResourceManager : No configuration information for resource
> loader named 'String'. Skipping.
> 
> Please help me in this issue. How do I initialise VelocityEngine to load
> velocity templates using StringResourceLoader
> 
> Thanks and Regards,
> Amit
> 

-- 
View this message in context: http://www.nabble.com/Error-in-intializing-Velocity-for-StringResourceLoader-tp18169294p18171137.html
Sent from the Velocity - User mailing list archive at Nabble.com.


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


Mime
View raw message