You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Brenton Strine <Br...@citrix.com> on 2006/09/22 03:05:57 UTC

Beginner trying to install velocity to apache server

Hi,

I've set up apache with PHP before, but only with
extensive help from howto guides. Now I want to be able
to test velocity (index.vm) pages on my home computer. I
tried to set it all up, but it doesn't seem to be
working.

Here is what I've done so far on my Windows XP computer:

*Installed Apache HTTP server 2.2.3 (downloaded .msi file
and ran it)
*Installed Java 2 SDK 1.4.2.12 (downloaded an .exe and
installed it. There is now a "java web start" folder in
my start menu)
*Installed Ant 1.6.5 (followed instructions in readme
file... had a very difficult time figuring out how to
modify PATH or set environment variables [didn't even
know what these were and had no idea where or how to set
them--still don't really understand what they do] I think
ant is running fine because in the CMD prompt I typed
things like "ant jar" and it did stuff.)
*Tried to install Velocity 1.4.
	-Extracted files to C:\server\velocity.
	-Used cmd to navigate to the build/ directory,
typed "ant jar-dep". It did tons of stuff. 
	-The readme file said to "update your classpath
to include Velocity's .jar file". I have no idea what
this means. I found buildcp.bat in convert/ and changed
it's contents from "@Echo off set
CLASSPATH=%CLASSPATH%;%1" to "@Echo off set
CLASSPATH=%CLASSPATH%;%1;C:\server\velocity
bin\velocity-dep-1.4.jar". (I think I realize now that
this was totally useless and stupid, but it will give you
a good idea about how confused I am.)
	-I also navigated to the examples/ directory with
the command prompt and typed "ant examples" which did
tons of stuff. 

However, when I look at .html or .vm files on
http://localhost/ in my webbrowser, either the velocity
gets treated like text.


What can I do to get Velocity up and running? I've
searched the net extensivly for info on setting up or
configuring Velocity in Apache, but my suspicion is that
I'm missing horribly obvious things that are hindering
further progress (example, maybe velocity isn't
"installed" at all, but rather... ?) 

I appreciate any help a lot. Thanks!

Brenton


Brenton Strine | Associate Web Developer

Citrix Online Division 
Citrix Systems, Inc.
5385 Hollister Avenue
Santa Barbara, CA 93111 USA 
www.citrix.com 

Phone: 805.690.7974 x:7974
Cell: 530. 966.6172
Fax: 805. 690.5849 
Email: brenton.strine@citrix.com 
 


Re: Beginner trying to install velocity to apache server

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
"Brenton Strine" <Br...@citrix.com> writes:

>*Installed Apache HTTP server 2.2.3 (downloaded .msi file
>and ran it)
>*Installed Java 2 SDK 1.4.2.12 (downloaded an .exe and
>installed it. There is now a "java web start" folder in
>my start menu)
>*Installed Ant 1.6.5 (followed instructions in readme
>file... had a very difficult time figuring out how to
[...]
>*Tried to install Velocity 1.4.
>	-Extracted files to C:\server\velocity.
>	-Used cmd to navigate to the build/ directory,
[...]

Brenton,

Velocity is Java code and if you want to use it in a web context, you
need a web container. Apache is just a web server and does not support
Java code directly. You wil need a "Servlet Container". Please check
out http://tomcat.apache.org/ for the one part that you have missed.

	Best regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

Social behaviour: Bavarians can be extremely egalitarian and folksy.
                                    -- http://en.wikipedia.org/wiki/Bavaria
Most Franconians do not like to be called Bavarians.
                                    -- http://en.wikipedia.org/wiki/Franconia

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


Re: Beginner trying to install velocity to apache server

Posted by Claude Brisson <cl...@renegat.net>.
Peter, recommending Struts and Hibernate to a newcomer isn't very
pedagogic neither pertinent. I'm telling people to avoid them... Telling
him that he needs to know java isn't either. Do you need to know c++ to
use apache/php ?

Brenton, as said before, Velocity itself is just a template engine that
will take a template file plus a context (a set of keys that map to data
or objects) and output the formatted file.

To "connect" it to the web, you will need two things: a java servlet
container (tomcat or resin or jboss or jetty or...), and a webapp (a
simple servlet or a set of servlets that compose a framework like Struts
or Click).

Here is what I would do:

1) Install the java servlet container. If you easily manage to install
Tomcat with Apache, then ok. Elsewhere, you can also try Resin
(caucho.com), which is an all-in-one web server (like Apache) plus
servlet container (like Tomcat).

2) Once installed, figure out in your servlet container where are the
webapps stored to plug-in your own one. I suggest you start with the
"simple" webapp example from the velocity-tools subproject (otherwise
Click is pretty cool also but needs java coding).

3) Populate your context (for instance, add a date formatting tool under
the $date key). The velocity-tools subproject allows you to do so by
means of a single toolbox.xml file, located under the WEB-INF
subdirectory of the webapp(*). Check for the generic tools and the view
tools in the docs of the velocity-tools subproject.

4) Play around with the template files...

(*) The WEB-INF directory of a webapp is the directory where the webapp
stores all its administrative files. Under it there are some other
directories of interest:
 - the /WEB-INF/lib directory is the place to put any needed java
library to be used by the webapp.
Be sure to restart the webapp when you add libraries or change the
toolbox.xml.
 - the /WEB-INF/log directory, especially the /WEB-INF/log/error.log
file, that you should check everytimes something doesn't work as
expected.

And don't hesitate to ask...

Regards,

  Claude

Le vendredi 22 septembre 2006 à 13:52 +1200, Peter Harrison a écrit :
> On Thu, 2006-09-21 at 18:05 -0700, Brenton Strine wrote:
> > Hi,
> > 
> > I've set up apache with PHP before, but only with
> > extensive help from howto guides. Now I want to be able
> > to test velocity (index.vm) pages on my home computer. I
> > tried to set it all up, but it doesn't seem to be
> > working.
> > 
> > Here is what I've done so far on my Windows XP computer:
> 
> <snip>
> 
> Apache doesn't serve VM files. Velocity is a Java template engine that
> many Java web applications use to render pages. Unlike PHP and Perl
> there is no module you can plug into Apache to render Velocity. You can
> have Apache connect to Tomcat, but thats quite complex if you are just
> learning.
> 
> One easy way to get started is to download Tomcat
> (jakarta.apache.org/tomcat) and run it. You will need to know Java and
> probably learn to use Struts if your application will be of any size.
> 
> As for books on the subjects, there are quite a few. One released in
> 2002 called "Mastering Tomcat Development" might give you a broad
> understanding of Tomcat, and I recommend it because.... I wrote it :)
> 
> Seriously though, there are many good books on Tomcat now, although you
> should look for something that also covers Struts and Hibernate - Struts
> being a system of wiring your applications together, and Hibernate which
> provides a object data persistence framework. Together with Velocity
> they provide a very mature technology stack that has been well tested.
> 
> Finally; there is no reason to front Tomcat with Apache anymore. It is
> still an option, but I have run application servers for years serving a
> large company with no separate static content provider. When learning to
> write java web applications its easier to do away with the extra
> complexity of Apache.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 


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


Re: Beginner trying to install velocity to apache server

Posted by Peter Harrison <pe...@nbn.co.nz>.
On Thu, 2006-09-21 at 18:05 -0700, Brenton Strine wrote:
> Hi,
> 
> I've set up apache with PHP before, but only with
> extensive help from howto guides. Now I want to be able
> to test velocity (index.vm) pages on my home computer. I
> tried to set it all up, but it doesn't seem to be
> working.
> 
> Here is what I've done so far on my Windows XP computer:

<snip>

Apache doesn't serve VM files. Velocity is a Java template engine that
many Java web applications use to render pages. Unlike PHP and Perl
there is no module you can plug into Apache to render Velocity. You can
have Apache connect to Tomcat, but thats quite complex if you are just
learning.

One easy way to get started is to download Tomcat
(jakarta.apache.org/tomcat) and run it. You will need to know Java and
probably learn to use Struts if your application will be of any size.

As for books on the subjects, there are quite a few. One released in
2002 called "Mastering Tomcat Development" might give you a broad
understanding of Tomcat, and I recommend it because.... I wrote it :)

Seriously though, there are many good books on Tomcat now, although you
should look for something that also covers Struts and Hibernate - Struts
being a system of wiring your applications together, and Hibernate which
provides a object data persistence framework. Together with Velocity
they provide a very mature technology stack that has been well tested.

Finally; there is no reason to front Tomcat with Apache anymore. It is
still an option, but I have run application servers for years serving a
large company with no separate static content provider. When learning to
write java web applications its easier to do away with the extra
complexity of Apache.



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


Re: Beginner trying to install velocity to apache server

Posted by Malcolm Edgar <ma...@gmail.com>.
Hi Brenton,

Velocity is a templating framework which is generally used by J2EE web
application frameworks, which you use to build your web application.

Possibly the easiest one of the to get going with is Click Framework:

  http://click.sourceforge.net

I will admit I am a little biased here, in that I principally wrote
Click, but we put it to great use in our company and it makes using
Velocity a snap.

Your Java web application will need to run in a Java application
server (Tomcat, JBoss, WebSphere, etc) which is generally then fronted
by an Apache web server.

regards Malcolm Edgar

On 9/22/06, Brenton Strine <Br...@citrix.com> wrote:
> Hi,
>
> I've set up apache with PHP before, but only with
> extensive help from howto guides. Now I want to be able
> to test velocity (index.vm) pages on my home computer. I
> tried to set it all up, but it doesn't seem to be
> working.
>
> Here is what I've done so far on my Windows XP computer:
>
> *Installed Apache HTTP server 2.2.3 (downloaded .msi file
> and ran it)
> *Installed Java 2 SDK 1.4.2.12 (downloaded an .exe and
> installed it. There is now a "java web start" folder in
> my start menu)
> *Installed Ant 1.6.5 (followed instructions in readme
> file... had a very difficult time figuring out how to
> modify PATH or set environment variables [didn't even
> know what these were and had no idea where or how to set
> them--still don't really understand what they do] I think
> ant is running fine because in the CMD prompt I typed
> things like "ant jar" and it did stuff.)
> *Tried to install Velocity 1.4.
>         -Extracted files to C:\server\velocity.
>         -Used cmd to navigate to the build/ directory,
> typed "ant jar-dep". It did tons of stuff.
>         -The readme file said to "update your classpath
> to include Velocity's .jar file". I have no idea what
> this means. I found buildcp.bat in convert/ and changed
> it's contents from "@Echo off set
> CLASSPATH=%CLASSPATH%;%1" to "@Echo off set
> CLASSPATH=%CLASSPATH%;%1;C:\server\velocity
> bin\velocity-dep-1.4.jar". (I think I realize now that
> this was totally useless and stupid, but it will give you
> a good idea about how confused I am.)
>         -I also navigated to the examples/ directory with
> the command prompt and typed "ant examples" which did
> tons of stuff.
>
> However, when I look at .html or .vm files on
> http://localhost/ in my webbrowser, either the velocity
> gets treated like text.
>
>
> What can I do to get Velocity up and running? I've
> searched the net extensivly for info on setting up or
> configuring Velocity in Apache, but my suspicion is that
> I'm missing horribly obvious things that are hindering
> further progress (example, maybe velocity isn't
> "installed" at all, but rather... ?)
>
> I appreciate any help a lot. Thanks!
>
> Brenton
>
>
> Brenton Strine | Associate Web Developer
>
> Citrix Online Division
> Citrix Systems, Inc.
> 5385 Hollister Avenue
> Santa Barbara, CA 93111 USA
> www.citrix.com
>
> Phone: 805.690.7974 x:7974
> Cell: 530. 966.6172
> Fax: 805. 690.5849
> Email: brenton.strine@citrix.com
>
>
>
>

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