1.0          Other languages

2.3 HTML files directory struture


VelocityWeb use HTML files as view layer instead of JSP. HTML files can be put in folder WebContent, and then pack into EAR file before deploy to application server. Or, put outside the deploy file, so that user can change it even after deployed.

Some news site, or BBS site, need to change web page style very often, weekly, or, monthly. Leave HTML files outside the deployed file will be good for this kind of business requirement.

Normally, we put HTML files inside the deployed file:

│  └─org
    │  ├─css
    │  ├─images
    │  ├─js
    │  └─pages
    │      ├─cart
    │      ├─layout
    │      ├─order
    │      ├─product
    │      ├─system
    │      └─user

The suggested way is to put all HTML files in same folder level relative to HTML root folder. Here is bad sample:

    │  └─pages
    │      ├─cart
    │      │      ├─view_cart.htm
    │      │
    │      ├─product
    │      │      ├─new_product
    │      │      │      ├─save_product.htm

In above sample, the CSS or image file links relative path are not same in view_cart.htm and save_product.htm. But at runtime, VelocityWeb has only one controller, which show dynamic web pages at one folder of the web server.

In view_cart.htm, may contains CSS link like this:

<link href="../../css/style.css" rel="stylesheet" type="text/css">

By default, controller servlet will be mapped to same folder level of WebContent with HTML files. To make the CSS take effective, you should change your servlet mapping to different URL path in web.xml:


And now, the URL


will be


And CSS works now.