velocity

velocity framework on google app engine

i am trying to use velocity framework on google app engine. i wrote a small program with a main method and tried running it locally. i get the following exception : Exception in thread "main" org.apache.velocity.exception.VelocityException: Failed to initialize an instance of org.apache.velocity.runtime.log.ServletLogChute with the curr...

NHibernate L2 Cache configuration in Fluent NHibernate

Is ti possible to configure the L2 cache provider in code via FHN? Adding a line to the following config is what I'm after: return Fluently.Configure() .Database(MsSqlConfiguration.MsSql2005.ConnectionString(c => c.FromConnectionStringWithKey("Temp")).ShowSql()) .Mappings(m => m.FluentMappings.AddFromAs...

in velocity can you iterate through a java hashmap's entry set() ?

Can you do something like this in a velocity template? #set ($map = $myobject.getMap() ) #foreach ($mapEntry in $map.entrySet()) <name>$mapEntry.key()</name> <value>$mapEntry.value()</value> #end ...

Is there any way to determine the velocity of a touch motion

I am making a drawing app and I want to increment my brush size depending on the touches velocity. How would I accomplish this? ...

Using $request.session.setAttribute to store a dropdown's setting

I'm trying to store a drop-down's setting that's controlling how many items to display in a roster. How do I go about doing this? The dropdown is using onChange to sort the results of the roster. ...

How to convert string into integer in velocity template?

i have a velocity template file which has the data from xml. I want to convert the string into integer type. can anyone help me to find out the solution. ...

Castle NVelocity Including Variables not Variable contents

I'm using Castles' NVelocity Engine to do some template work. Here's the problem. Several of my templates work fine, but one of them isn't. #foreach($i in $Items) <div class="grid_3 folioItem"> <a rel="prettyPhoto[portfolio]" href="$i.Link" class="lightBox"><img src="$i.Image" width="220" height="125" alt="showcase" /></a> <h4>$i.Sho...

JSP with Struts 1.2 from a velocity user

Hi All, We have a mature application running struts 1.2 and velocity and I need to covert a page from a vm to a jsp. So I modified my struts-config to change the forward to a new JSP file and in the JSP I try to display some data assigned to the form bean but all the form properties show empty in the JSP. When I look at the form itself...

What is the syntax for if false in nVelocity?

Hi, What is the syntax for an not true or false if statement in nVelocity (or Velocity)? And more importantly, where is this in the nVelocity docs? I've been Googling for quite a while to no avail. I've tried several different combinations such as: #if (!$artist.IsFestival) $artist.FestivalName #end and #if ($artist.IsFestival ...

In velocity, I need to grab specific class of people from a list

I need to grab specific people by their names, such as, John, Tim, Eric etc. Not display the whole list. #foreach($userClass in $classList) #set($people = $guild.getRosterByClass().get($userClass.name)) $userClass.name #if($people && $people.size()) $people.size() #else 0 #end <br/> #end Please help, thanks! ...

How can I convert a velocity expression to JSP?

I have a page which I'm converting from Velocity to JSP. I have some complex expressions which I can't figure out how to convert to JSTL el language. #set ($col = 0) #foreach ($hour in $form.bean.grid.hours) $hour.cells.get($col).hourOfDay #set ($col = $col + 1) #end Hour is an object which contains a cell which contains a list....

Need a Java-based HTML prettifier to clean up Velocity-generated HTML

Hello, Web app I'm working on generates HTML using Velocity templates. Problem is that using whitespace in velocity templates and other formatting results in butt-ugly HTML (excessive whitespace, misalignment, etc.) Looking for a nice (single jar packaging would be nice) Java-based HTML prettifier to run over the generated HTML right b...

Calling class methods (static) from inside a velocity view page

Can you call class methods from inside a view page? Specifically ones that are not passed into the view? i.e. In asp.net MVC I can do this: <%= SomeClass.FixDateFormat(ViewData.Model.SomeClass.DateCreated) %> ...

Velocity: How to evalute/parse "Directives/Content" held in a Variable?

Hello Experts, I have problem that seems to be rather trivial but I was not able to solve it. In my Velocity-Templates I have a variable $contentFormDb that has been populated with Content from the Database (In the Controller of the MVC App). This Variable will not only contain literal Strings but also further Velocity Directives (like...

Apache Velocity performance pitfalls?

We are using Apache Velocity for website templates and some of them are getting complex. Have you noticed any performance issues with certain Velocity features? And how did you get around them? ...

What are some advance concepts with Velocity?

I am looking at the documentation of velocity, and it seems very straightforward. i.e. something that one can pickup in 2 hours Am I missing something? What are the more advanced concepts with Velocity? Any major quirks? ...

Reference a Map by name within Velocity Template

Pretty sure there is an easy answer to this, but just can't find the right VTL syntax. In my context I'm passing a Map which contains other Maps. I'd like to reference these inner maps by name and assign them within my template. The inner maps are constructed by different parts of the app, and then added to the context by way of exampl...

Configure the variable convention in velocity

Hi Everyone Anyone has an idea whether the variable convention in Velocity can be configured? I mean can I configure the template engine to recognize the variables when they start with something else and not with $ ? like #body instead of $body. Thanks Roman ...

How to inject widgets into a velocity page, when you don't know which widjects are in the page?

Say you have a user editable section where they can insert custom tags into the velocity template. From what I understand, you have to initialize the velocity context with the objects you want on the page. If you don't want to pre-load all the widgets into the page for performance reasons, and you don't know which widgets are in the pa...

Help designing velocity template to support Header and Footer

My websites pages are broken down into 3 parts: Header Main Content Footer The header needs to access the user object to display things like the username, sign/signout links depending if the user is logged in or not. I want my velocity templates to be like this: inject header template, that will need access to the user object. mai...