followup questions inline below... On Mon, Sep 1, 2008 at 2:54 AM, emri <[EMAIL PROTECTED]> wrote: > > Hello, > > I can't get generic-tools working in my Struts2 Config, objects are not > instanciate and are render as String in templates. I don't find any > information, samples to get this working, it seems so simple to read :), but > impossible to make it work for me :( > > Can you point me my error, a link, an hint, an advice, anything :D ? > > Thanks ! > > > I use Struts 2, Velocity 1.5, Velocity Tools 1.4 > > My configs files are: > > Toolbox.xml > -------------- > <toolbox> > <tool> > <key>date</key> > <class>org.apache.velocity.tools.generic.DateTool</class> > <scope>request</scope> > </tool> > <tool> > <key>alternator</key> > <class>org.apache.velocity.tools.generic.AlternatorTool</class> > <scope>application</scope> > </tool> > <tool> > <key>list</key> > <class>org.apache.velocity.tools.generic.ListTool</class> > <scope>application</scope> > </tool> > </toolbox> > -------------- > > > Web.xml > -------------- > <servlet> > <servlet-name>velocity</servlet-name> > > <servlet-class>org.apache.velocity.tools.view.servlet.VelocityViewServlet</servlet-class> > <init-param> > <param-name>org.apache.velocity.toolbox</param-name> > <param-value>/WEB-INF/toolbox.xml</param-value> > </init-param> > <init-param> > <param-name>org.apache.velocity.properties</param-name> > <param-value>/WEB-INF/velocity.properties</param-value> > </init-param> > <load-on-startup>10</load-on-startup> > </servlet>
are you sure that it is the VelocityLayoutServlet that is doing the processing of your templates? I believe Struts 2 has their own way of supporting Velocity that doesn't use the VelocityViewServlet. > velocity.properties > -------------- > > runtime.log = velocity.log > > runtime.log.error.stacktrace = false > runtime.log.warn.stacktrace = false > runtime.log.info.stacktrace = false > runtime.log.invalid.reference = true > runtime.log.logsystem.class = org.apache.velocity.runtime.log.Log4JLogSystem > runtime.log.logsystem.log4j.pattern=%d - %m%n > > > input.encoding=ISO-8859-1 > output.encoding=ISO-8859-1 > > > directive.foreach.counter.name = velocityCount > directive.foreach.counter.initial.value = 1 > > directive.include.output.errormsg.start = <!-- include error : > directive.include.output.errormsg.end = see error log --> > > directive.parse.max.depth = 10 > > > resource.loader = file > > file.resource.loader.description = Velocity File Resource Loader > file.resource.loader.class = > org.apache.velocity.runtime.resource.loader.FileResourceLoader > file.resource.loader.path = > /home/jboss/server/webServer/deploy/webServer.war/views/HTML > file.resource.loader.cache = false > file.resource.loader.modificationCheckInterval = 2 i'm fairly skeptical that this works. you can't typically address files within a war like this. you could just use the default "webapp" resource loader that the VelocityViewServlet provides. i think you just need to remove the file.resource.loader properties above and add this one: webapp.resource.loader.path = /view/HTML > > velocimacro.library = pz_const.vm, pz_libs.vm > > velocimacro.permissions.allow.inline = true > velocimacro.permissions.allow.inline.to.replace.global = false > velocimacro.permissions.allow.inline.local.scope = false > > velocimacro.context.localscope = false > --------------------- > -- > View this message in context: > http://www.nabble.com/Struts2---Velocity-Tools-tp19251905p19251905.html > Sent from the Velocity - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
