velocity

How to XML escaping with Apache Velocity?

I am generating XML using Apache Velocity. What is the best (most straight-forward) way to XML-escape the output? (I saw there is an escape tool, but could not figure out it's dev state. I also think that XML escaping is something that is very likely supported by Velocity directly.) ...

Converting a constantly changing scalar value to a changing interval or frequency

Although I'm coding in Objective C, this is more of a general programming question. What is the best way to convert a constantly changing scalar value to a changing interval or frequency? Right now every time the scalar value changes I am destroying the NSInterval ie [self.myTimer invalidate]; self.myTimer = nil; and creating...

Smooth scrolling and syntax highlighting in MacVim

Is there any way to get MacVim to scroll more smoothly TextMate style? While I'm here, is there a syntax file I can edit to add syntax highlighting to files? I have Velocity .vhtml files which are largely regular HTML with a bit of VTL thrown in. If I could just add .vhtml as an extension to the HTML syntax highlighter that would alread...

Velocity $fn docs

I notice in some Velocity reports I'm working with that $fn contains some built in functions for Velocity. I can't seem to find a list of these. For example, `$fn.formatNumber($fn.duration($time),'##0.0') My google-fu has failed me on this one. Anyone have link to the docs on this? ...

velocity (test instanceof)

Hi all, How can I test the class of a given object in a velocity template. I can't find an instanceof directive Thkx a lot, It's for urgent need Mira ...

How to validate HTML matches W3C standards

I have a project that generates HTML pages using velocity template and Java. But most of the pages do not comply with W3C standards. How can I validate those HTML pages and get a log telling me what errors/warnings on what pages? Then I can fix the errors manually. I have tried JTidyFilter but that doesn't work for me. ...

Can I get Velocity inner Method?

Can I get Velocity inner Method? #set ( $scripts = [ "https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js" ] ) #foreach($URL in $scripts) <script type="text/javascript" src="$URL"></script> #end $scripts.add("http://www.cnr.cn") $script.remove(0...

Displaying parsed HTML output using Velocity

i have a velocity template... It contains the following tag: #field('itemname') The "itemname" variable contains this: <i>Some</i> <b>Example Title</b> The source of the outputted page has this: <i>Some</i> <b>Example Title</b> So, the user sees the actual HTML tags: <i>Some</i> <b>Example Title</b> What I want them to ...

Problems with Jetspeed not showing the Edit option

Hello, I'm fairly new to Jetspeed and I'm having some problems getting everything to work correctly. I'll list off what I consider to be the relevant code snippets for reference and then explain the problem. Portlet.xml snippet: <portlet-app id="Fake" version="1.0"> <portlet id="MyPortletID"> <portlet-name>MyPortletName</p...

getClass().getClassLoader().getResourceAsStream() is caching the resource

I have a resource (velocity template) which I'd like to be able to swap during development. However, getClass().getClassLoader().getResourceAsStream() seems to cache the template. Is there a way to disable this besides using a file loader instead of the class loader? ...

Using Velocity's WebappResourceLoader with Spring

I'm trying to use Velocity to create an email template that is mailed by Spring's JavaMailSender class. The resource loader that I decided to use to find the Velocity template in my web app is WebappResourceLoader which is located in the Velocity tool jar. However, depending on how I use the WebappResourceLoader, I get either a NPE w...

Why would I use a templating engine? jsp include and jstl vs tiles, freemaker, velocity, sitemesh

I'm about to choose to way to organize my view (with spring-mvc, but that should matter much) There are 6 options as far as I see (though they are not mutually exclusive): tiles sitemesh freemaker velocity <jsp:include> <%@ include file=".."> tiles and sitemesh can be grouped; so can freemaker and velocity. Which one within each gro...

Where does Velocity search for the template?

I need to use Velocity from Java-code in a web-application (I use it as mail-templates processor). So, I have a standard code: VelocityEngine ve = new VelocityEngine (); try { ve.init (); Template t = ve.getTemplate (templatePath); ... } catch (Exception e) { throw new MailingException (e); } This code always throws th...

constructing graphs in Java

hello everyone, i need to plot velocity graph for my velocity vector data(x axis velocity x comp, y axis velocity y comp). there is a quiver plot in matlab which does so, is it possible to some how draw such graphs in Java. please some one can tell how to do it, it would be real help. ...

How to set content type for emails sent using spring's JavaMailSenderImpl

Hi, question is from subject. I'm using JavaMailSenderImpl from spring 3.0.3.RELEASE and velocity 1.6.4 for mail preparation from template. When I send email with Croatian characters from my webapp recipient receives "?" in stand of normal Croatian characters. If I turn debug mode for mails, from log I can see that Content-type is ...

Apache Velocity: hashtable?

Hi, a velocity syntax page -- http://velocity.apache.org/engine/devel/user-guide.html#Loops -- mentions a "Hashtable". However there's no mentioning how to create one in this language. So if you could show how to do this -- so that I could write smth. like #foreach( $key in $foo.keySet() ) <li>Key: $key -> Value: $foo.get($key)</l...

For loop in NVelocity.

Does NVelocity support #for loops? I've looked through the documentation and all I could find was the #foreach loop. I want to loop over a 2 dimensional array. ...

source code(COBOL) generation using a java program

I am going to write a code generator to generate a COBOL program using some input file of records. I am going to implement it as java program. I think XML/XSL approach would not be appropriate in this case, because the input file is not in XML format. I think a template processor would be helpful, because some parts of it can be generat...

Velocity cant find resource.

Something is wrong and it is very frustrating. I read on velocity's homepage that when I run a wepapp then some properties should be set. And I've done that but no matter what I do I keep getting the same error. This is where I set the props and use velocity public class ConfirmationMailGenerator implements MailGenerator { private...

Converting a Java object to a Javascript object using velocity

Hi, If a have a Java object (lets say a User object), and I use velocity to template the page so I can access a field in the user object like ${user.id}, is there an easy way to convert this into a javascript object (so I can access the fields of the User object)? I can assign a value to javascript variable like var id = "${user.id}...