I want to use Velocity in a web application in order to add dynamic content from a database to html files. I've configured Velocity successfully by using the VelocityViewServlet. My web.xml looks like this:
<servlet>
<servlet-name>velocity</servlet-name>
<servlet-class>org.apache.velocity.tools.view.VelocityViewServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>velocity</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
I want to load some content in these way:
#set( $pageId = "6655231")
$data.getContent($pageId)
Where should I set the property $data ?
Should I set the property in a own HttpServlet implementation that extends VelocityViewServlet?
Or is there an other way?
Aucun commentaire:
Enregistrer un commentaire