Deprecated Garbage Collections – Kenny Lee Chee Wei

A truckload of garbage by Kenny Lee Chee Wei

Archive for July 2007

Javascript support in Spring Velocity Macros

with 4 comments

I’m using Velocity templates as the “view” for a new Spring MVC project.

Velocity Spring macros are available which can be used to bind object attributes to the html form elements.

While reading Chapter 14 from Spring MVC documentation, i noticed the VTL definition for a html select element looks like #springFormSingleSelect( $path $options $attributes).

We can pass javascript behaviour into the $attribute parameter like,

#springFormSingleSelect( "new_match.competition" $competitions "onchange=updateTeams()")

which produces,

<select id="competition" name="competition" onchange=updateTeams()> <option value="1">English Premier League</option>

<option value="2">Spanish Primera Liga</option>

<option value="3">Italian Serie A</option>


Written by kennii

July 17, 2007 at 4:35 am

Posted in Spring Framework