The main problem is to tell velocity where to find the templates in the
jboss deploy directory. This is simple:

You need a velocity.properties file
--
resource.loader=classpath
classpath.resource.loader.class =
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader

runtime.log.logsystem.class =
org.apache.velocity.runtime.log.AvalonLogSystem
runtime.log.error.stacktrace = false
runtime.log.warn.stacktrace = false
runtime.log.info.stacktrace = false
runtime.log.invalid.references = true
--

You need to tell your Velocity Servlet where to find it in web.xml
--
    <servlet>
     <servlet-name>ControllerServlet</servlet-name>
     <servlet-class>hero.servlet.ControllerServlet</servlet-class>
      <init-param>
        <param-name>properties</param-name>
        <param-value>WEB-INF/lib/velocity.properties</param-value>
      </init-param>
    </servlet>
--

Then you must put all your templates in a jar that can be found in the
classpath
The best is to put your templates in a jar and to put the jar in the
WEB-INF/lib
Don't forget to put the velocity.jar there also.
I'm not sure everything is useful in this description but it works for me
like that

$ jar tvf heroweb.war
     0 Wed Jun 27 10:34:14 CEST 2001 META-INF/
    46 Wed Jun 27 10:34:14 CEST 2001 META-INF/MANIFEST.MF
     0 Sat May 12 22:58:42 CEST 2001 images/
     0 Sun May 13 13:12:32 CEST 2001 login/
     0 Sun May 13 13:12:38 CEST 2001 protected/
  1441 Thu Apr 19 10:47:18 CEST 2001 images/tomcat.gif
   975 Thu Apr 19 10:47:18 CEST 2001 hello.jsp
   143 Sun May 13 13:13:10 CEST 2001 login/error.jsp
   299 Sun May 13 13:13:10 CEST 2001 login/login.jsp
   871 Sat May 12 00:11:12 CEST 2001 protected/index.jsp
  1326 Wed Jun 20 00:03:24 CEST 2001 index.html
     0 Tue Jan 01 00:00:00 CET 1980 WEB-INF/
     0 Tue Jan 01 00:00:00 CET 1980 WEB-INF/lib/
 96920 Wed Jun 27 10:34:16 CEST 2001 WEB-INF/lib/hero.jar
  2750 Tue Jun 19 23:50:46 CEST 2001 WEB-INF/lib/templates.jar
   363 Tue May 22 10:37:46 CEST 2001 WEB-INF/lib/velocity.properties
373565 Wed May 23 11:12:18 CEST 2001 WEB-INF/lib/velocity-1.0.1.jar
     0 Tue Jan 01 00:00:00 CET 1980 WEB-INF/classes/
     0 Mon May 21 14:13:16 CEST 2001 WEB-INF/classes/hero/
     0 Mon May 21 14:13:18 CEST 2001 WEB-INF/classes/hero/servlet/
  2685 Mon May 14 21:48:10 CEST 2001 WEB-INF/classes/Project.class
   776 Mon Jun 18 15:19:22 CEST 2001
WEB-INF/classes/hero/servlet/Command.class
  2595 Tue Jun 19 23:21:34 CEST 2001
WEB-INF/classes/hero/servlet/ControllerServlet.class
  1732 Mon Jun 18 16:21:34 CEST 2001
WEB-INF/classes/hero/servlet/DisplayCommand.class
  2012 Mon May 21 15:21:20 CEST 2001
WEB-INF/classes/hero/servlet/Hello.class
  1873 Mon Jun 18 16:29:18 CEST 2001
WEB-INF/classes/hero/servlet/NodeDisplayCommand.class
  1756 Mon Jun 18 16:21:34 CEST 2001
WEB-INF/classes/hero/servlet/EdgeDisplayCommand.class
  1957 Mon Jun 18 15:19:22 CEST 2001
WEB-INF/classes/hero/servlet/ValueContainerDisplayCommand.class
  2433 Mon Jun 18 11:10:02 CEST 2001
WEB-INF/classes/hero/servlet/ValueContainerSetCommand.class
  1503 Tue Jun 19 23:23:48 CEST 2001
WEB-INF/classes/hero/servlet/UserSessionDisplayCommand.class
  1999 Mon May 21 18:39:44 CEST 2001 WEB-INF/classes/Hello.class
   125 Mon Jun 18 17:08:38 CEST 2001 WEB-INF/jboss-web.xml
     0 Tue Jan 01 00:00:00 CET 1980 templates/
   768 Mon Jun 18 17:14:28 CEST 2001 templates/valuedisplay.vm
   224 Mon Jun 18 15:18:40 CEST 2001 templates/error.vm
   620 Mon Jun 18 16:49:00 CEST 2001 templates/nodedisplay.vm
   648 Mon Jun 18 16:49:12 CEST 2001 templates/display.vm
   440 Mon Jun 18 16:49:28 CEST 2001 templates/edgedisplay.vm
    78 Tue Jun 19 23:08:56 CEST 2001 templates/header.html
   663 Tue Jun 19 23:50:32 CEST 2001 templates/usersessiondisplay.vm
  2114 Mon Jun 18 17:04:02 CEST 2001 WEB-INF/web.xml



----- Original Message -----
From: "Devraj Mukherjee" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 27, 2001 5:34 AM
Subject: [JBoss-user] Velocity installation with JBoss


> Can anyone give me any pointers with installing Velocity with JBoss.
>
> Devraj
>
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
>


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to