May I suggest that you consider using Soy templates instead of Velocity? Soy templates are used by the newer Atlassian products, and I believe the plan is to use them in new features added to JIRA and Confluence. In any case, Atlassian appears to be moving towards Soy and away from Velocity.
There is a suitable tutorial on using Soy templates in Confluence.
The documentation for Soy templates is published by Google.
Generally, you'll want to create a plugin to bundle all your code together and make it interact. Your other questions mention Confluence, so I'd start at https://developer.atlassian.com/display/CONFDEV/Confluence+Plugin+Guide
Even if this is not the right approach for your answer, the process of working through writing a plugin will teach you the basic stuff you need to understand to write code for Confluence, especially how java and velocity interact
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
...staring into the background. Once the image pops out in 3D, you can look around the picture and enjoy. If you will see if you are a true illusion master! :) You did it? :) Wow! Awesome! As a bonus...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs