Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You will also need a <em>Java EE container</em> (aka <em>servlet container</em>) like Apache Tomcat. The Apache HTTP server doesn't know anything about Java. Please note that Tomcat can itself be used directly as an HTTP server - you would typically choose to keep Apache HTTP server in front of Tomcat on production servers to speed up static files requests among other reasons (Apache HTTP can forward requests to Tomcat with the mod_proxy_ajp module). But for the beginning, it's easier to directly use the HTTP service provided by Tomcat.</p> <p>Then, you need to get familiar with the concept of a <em>Web Application</em>. It's nothing more than a specific hierarchy of files (that can be compressed into a jar file with the <em>.war</em> extension). For a web application using Velocity, that would typically be:</p> <p>./ &larr; <em>root of your web application</em><br/> ./index.vhtml &larr; <em>your welcome page template</em><br/> ./foo/bar.vhtml &larr; <em>any other file or subdirectory containing your web resources</em><br/> ./WEB-INF/ &larr; <em>the WEB-INF directory contains all web application configuration</em><br/> ./WEB-INF/web.xml &larr; <em>maps HTTP requests towards filters and servlets</em><br/> ./WEB-INF/tools.xml &larr; <em>optional configuration file for your Velocity custom tools</em><br/> ./WEB-INF/velocity.properties &larr; <em>optional file to tune Velocity configuration</em><br/> ./WEB-INF/lib/ &larr; <em>contains all the libraries needed by your web application</em><br/> ./WEB-INF/src/ &larr; <em>contains your custom Java classes source code</em><br/> ./WEB-INF/classes/ &larr; <em>contains your custom Java classes</em><br/></p> <p>Your <em>web.xml</em> file has to map adequate requests towards the VelocityViewServlet. It will look like this:</p> <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt; &lt;web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&gt; &lt;servlet&gt; &lt;servlet-name&gt;view&lt;/servlet-name&gt; &lt;servlet-class&gt;org.apache.velocity.tools.view.VelocityViewServlet&lt;/servlet-class&gt; &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;view&lt;/servlet-name&gt; &lt;url-pattern&gt;*.vhtml&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;/web-app&gt; </code></pre> <p>I cannot help you much with Eclipse as I don't use it, but there seems to be several tutorials online if you search for tomcat + eclipse. Here's one that looks interesting:<br/> <a href="http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html">http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload