Questions tagged [velocity]

Apache Velocity is a Java-based template engine. It can be used to dynamically generate web pages, email messages, source code, or any other text file.

Apache Velocity is a Java-based template engine. It can be used to dynamically generate web pages, email messages, source code, or any other text file.

Apache Velocity is a project of the Apache Software Foundations (ASF).

More information is available at the project home page: http://velocity.apache.org.

From the developer perspective, the fundamental pattern for rendering a text file is:

  • Create and initialize a VelocityEngine.
  • Add your data objects to a Context (essentially, a map of objects available for use in the template)
  • Choose a template
  • Merge the template with the context.

This can be done in a few lines of Java code, or you can use one of several frameworks to integrate this with your application.

One of the most popular web application frameworks which integrates Velocity is the Spring Framework. For simple servlet based applications, most developers use one of the Velocity Tools servlets (also available from the Apache Velocity project).

Useful Online Resources

  1. Velocity User Guide
  2. Velocity Developer Guide
2370 questions
0
votes
0 answers

OpenHTMLToPDF build not hole document

I'm generating pdf file with OpenHTMLToPDF. Using Velocity to render html and then to pdf with OpenHTMLToPDF. In this document there are 2 pages and first one is good but second is empty, but html which came to my render method is also ok. I cannot…
0
votes
1 answer

Google Appengine CRON task with spring velocityengineutil

I am trying to write a cron task in app engine for sending emails by calling mergetemplatewithstring in spring velocityengineutils. Unfortunately it does not throw any exception but the mail is never sent. Anyone has any pointers?
retrobrain
  • 390
  • 3
  • 15
0
votes
2 answers

Apache Velocity 2.0 how to write a custom resource loader?

There is a ResourceLoader class in the API documentation: https://velocity.apache.org/engine/2.0/apidocs/org/apache/velocity/runtime/resource/loader/ResourceLoader.html I would like to implement my own loader, because I need to load templates from a…
nagylzs
  • 3,954
  • 6
  • 39
  • 70
0
votes
1 answer

How to populate velocity string with a JSON Object in JAVA?

I am working on velocty and java, I was to take values from an json file (which I took using recursion of JSON OBjects and storing path of recursion(See context below to get idea) String hhh="I am a ${root.primaryApplicant.firstName} ${firstName}…
user34096
  • 15
  • 5
0
votes
0 answers

Plot a contour map of v component of geostrophic velocity

I need your help to figure out the answer for this question. I've spent my 3 days but I haven't still figured out how to do this. Here my question: https://i.stack.imgur.com/OiOuT.png
0
votes
1 answer

Using special characters in Velocity templates

I'm trying to use em dash (—) and multiplication symbol (×) in my Velocity template. But the output gives the following. — for em dash × for multiplication symbol I have added
Nimila Hiranya
  • 4,842
  • 10
  • 35
  • 52
0
votes
1 answer

Velocity 1.7 - Sometimes Directive.postRender throws NullPointerException in Velocity.evaluate

I have came across an issue while using Velocity template. It is throwing NullPointerException for Directive.postRender for a foreach function used in my template. Strange behavior is that with exactly same template and same input data, Velocity is…
www.hybriscx.com
  • 1,129
  • 4
  • 22
0
votes
1 answer

A Java Server side (Jsp, velocity, whatever) Calendar component?

Do you know of a Java Server side calendar component. Not a date picker, but a way to display months or weeks as in google calendar with events from my db.
flybywire
  • 261,858
  • 191
  • 397
  • 503
0
votes
1 answer

How can I get Velocity to retrieve a template from a datasource with Microsoft JDBC driver?

My Java application previously ran against a SQL Server database using the Sourceforge jTds driver. It was able to use the Apache Velocity engine (v2.0) to retrieve templates from a varchar(max) column in the database. Now the database is to be…
0
votes
1 answer

Upgrading dotcms 2.5.7 to 3.7.2 $folder = $fileRepository_filesList.get(0).folder - won't return folder id

I upgraded dotcms from 2.5.7 to 3.7.2. The following code is actually linked to a button which opens a slideshow. This code was working in old cms, but won't in the 3.7.2 Funny thing! - If I am not logged in in the backend this code works otherwise…
pero58
  • 1
  • 1
0
votes
1 answer

How to add values to dynamic(?) map in velocity?

I have the following velocity code. #foreach($content in $list) #set($map = {$content.categoryName:[]}) #foreach($child in $children) // I want to add values to $map.$content.categoryName #end #end I would like to add values to…
Moon
  • 22,195
  • 68
  • 188
  • 269
0
votes
1 answer

Error processing email body when using velocity script in Marketo

I'm trying to add an email script token that will take only part of the string BEFORE the opening parenthesis. So the string is "Hello (www.google.com)" then I only want "Hello". This is for use in a Marketo email. The code that I'm trying to use…
0
votes
1 answer

Decode base64 string in AWS AppSync Velocity resolver?

My aim is to create an AWS-AppSync GraphQL API that implements the Relay Cursor Connections Specification. Specifically I want to add opaque cursors for some Elasticsearch queries. My cursor would be the sort values array for the search_after API.…
0
votes
2 answers

Using the #set() directive in an #if() #elseif() statement

I am attempting to add dynamic content to an email and want to remove the velocity syntax from the email body and replace it with a $var by using the #set directive like this: #if('x' = 'y') #set($z = 'z') #elseif( 'a' = 'b') #set($c = 'c') This…
0
votes
1 answer

How to get Angle of velocity to rotate a bullet?

I have this: CGPoint vel = hudLayer.rightJoystick.velocity; CCBullet* sp = [CCBullet spriteWithFile:@"green.png"]; sp.position = player.position; [self addChild:sp z:-10]; vel =…
cocos2dbeginner
  • 2,185
  • 1
  • 31
  • 58
1 2 3
99
100