Drive has 700+ articles for digital transformation leaders written by StarCIO Digital Trailblazer, Isaac Sacolick. Learn more.

We are using Velocity Web Edit in Eclipse to edit our velocity templates. It leads to some nice development procedures.1) Whenever you’re creating or editing a vm file, make sure that you have the Eclipse editor open the .vm file and have an editor open to the class (in our case, Action class since we’re using Struts).
2) When you add a new object to the context, you can make Eclipse aware of the object. Just click on the Context tab (on the vm file’s editor window, it will be in the bottom left hand corner) and add the name/class of the object.
3) This will help you keep the editor for the .vm file and your action class (or whatever you’re using to fill the context) in sync. You’ll now be able to use Eclipse’s autocomplete features on your context objects.

One gotcha: VelocityWebEdit doesn’t seem to know about generics. You can add a collection to the context and have VWE recognize this collection, but you won’t be able to do an autocomplete on the objects that make up your collection.

Here is an easy work around. Let’s say you have a ArrayList that you add to the VelocityContext under the name ‘lstStrings’.

1) Open the context tab for the vm file
2) Add ‘lstStrings’ as a ‘java.util.ArrayList’
3) Add ‘strObj’ as a ‘java.lang.String’

Then, when you need to loop over your array, use ‘strObj’ as you’re looping variable. Since you told VWE that strObj is a String, you’ll be able to use the autocomplete features on this object.

Published on:

Topics:

Leave a Reply


StarCIO

My company, StarCIO, provides leadership, learning, and advisory programs for companies looking to accelerate delivering business value from digital transformation. Contact me if you’d like to learn more about partnering opportunities.


Isaac Sacolick

Greetings from Isaac Sacolick

If you enjoy my thought leadership, please sign up for the Driving Digital Newsletter and read all about my transformation stories in Digital Trailblazer.


Coffee with Digital Trailblazers hosted by Isaac Sacolick

Digital Trailblazers! Join us Fridays at 11am ET for a live audio discussion on digital transformation topics:  innovation, product management, agile, DevOps, data governance, and more!


Join the Community of StarCIO Digital Trailblazers

1 comment:

  1. I haven’t tried extending VelocityServlet… Just never had the need to do it. I also haven’t spent much time customizing things in Eclipse. So sorry to say, I don’t have a solution to this problem.

About Drive

Drive Agility, Innovation, Transformation

Drive is the blog for digital transformation leaders brought to you by StarCIO and Isaac Sacolick.

Agility, Innovation, and Transformation are the three primary digital transformation core competencies that every StarCIO Digital Trailblazer must champion in their organizations. Learn more About Drive.


About the StarCIO Digital Trailblazer Community

StarCIO Digital Trailblazer Community

Revolutionizing traditional learning, networking, and advising experiences.

Visit the community


About StarCIO

Learn More about StarCIO

About Isaac Sacolick

Isaac Sacolick

Author, 1,200+ articles, keynote speaker, Chief StarCIO Digital Trailblazer. Full bio


Driving Digital Newsletter

Driving Digital Newsletter

StarCIO Guides

Learn StarCIO Agile Planning

Digital Trailblazer

Digital Trailblazer by Isaac Sacolick

Driving Digital

Driving Digital by Isaac Sacolick

Driving Digital Standup

Driving Digital Standup

Coffee with Digital Trailblazers

StarCIO Coffee With Digital Trailblazers

Recognition

reworked imapct awards 2026 Judge
InfoWorld 2025 Judge
InfoWorld Technology of the Year 2024 Judge
Thinkers360 Top 10 in IT Leadership
Thinkers360 Top Agile Thought Leader
Thinkers360 Top DevOps Leader
Thinkers360 Top in Digital Transfomation
Thinkers360 Top in Analytics
Thinkers360 Top in Product Management

Discover more from StarCIO Digital Trailblazer Community

Subscribe now to keep reading and get access to the full archive.

Continue reading