On 7/26/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > I am working with wicket 1.3 and use Velocity for generating emails by > templates. > With wicket it works good, but now (with wicket 1.3) Velocity cannot > load templates > > Properties props = new Properties(); > props.setProperty("resource.loader", "file"); > props.setProperty("class.resource.loader.class","org.apache.velocity.runtime.resource.loader.FileResourceLoader"); > > /* установка пути к папке с шаблонами */ > props.setProperty("file.resource.loader.path", > ResourceLocator.getInstance().getResourcePath(ResourcesTypes.MAIL_TEMPLATES_FOLDER)); > props.setProperty("file.resource.loader.cache ", "true"); > props.setProperty("file.resource.loader.modificationCheckInterval", "2"); > props.setProperty("runtime.log.logsystem.class", > "org.apache.velocity.runtime.log.NullLogSystem"); > > Velocity.init(props); > VelocityContext vc = new VelocityContext(); > Template t = > Velocity.getTemplate("restore_password.vm");//tmpMessage.getTemplate());
Do you include the wicket-velocity project (and if you do, do you really need it)? The problem with velocity is that once initialized, it will ignore other calls to initialized (see org.apache.velocity.runtime.RuntimeInstance#init). A fine example of the dangers of using static. Now, if you do include wicket-velocity (make sure you really need it), you need to configure that using some context parameters it seems. Look at org.apache.wicket.velocity.Initializer#getVelocityProperties. From a glance over the code, it looks like you need to configure context parameters (in web.xml) 'velocityPropertiesFolder', which is a folder relative to the web app root, and 'velocity.properties' that should point to your Velocity properties file in that directory. Tbh, Jean Baptiste, it looks to me like we could simply things a bit. Can't we just have one parameter where you either give a relative path that is then interpreted as relative to WEB-INF, or an absolute path that is just interpreted as absolute, and can't we try a default location (like WEB-INF/velocity.properties or maybe whatever is customary in Velocity's world) in case a parameter isn't provided? Eelco ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ IMPORTANT NOTICE: This mailing list is shutting down. Please subscribe to the Apache Wicket user list. Send a message to: "users-subscribe at wicket.apache.org" and follow the instructions. _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user