I have a module written in servlets and needs to be recently moved to velocity framework
So in the process I am rewriting the web.xml to create velocity servlet object whcih calls
our original servlet .
Now if this has to be moved to
<servlet>
<servlet-name>VeloServlet</servlet-name>
<servlet-class>org.apache.velocity.tools.view.s...
I have a website that uses JSP as its view technology (and Spring MVC underneath). Unfortunately, JSP is just a pain to use for anything that doesn't involve an HTTP session. I would like to be able to occasionally send my users some email, and I want to use something JSP-like to render the email's contents. Technologies I'm aware of ...
I was investigating FreeMarker (and also Velocity), and one of the things I liked about FreeMarker was that I could use it with my existing JSP tags. However, it's become my understanding that this will only work when using FreeMarker as a view for servlets. Is there a way to use these JSP tag libraries with either FreeMarker or Veloci...
I have a variety of Velocity template files that represent e-mail messages. I am searching for an elegant way to allow the template file to output a subject line for the message as well as the contents. I have considered a few options:
Make the first line of the output something like "Subject: Bla" and strip it out in the Java. I ha...
hi, all. I need to use java 5 enum in velocity template, so that I could write something like
public enum Level{
INFO, ERROR;
}
Velocity template:
#if($var == Level.INFO)
...
#else
...
#end
How can it be done? Thanks in advance.
...
Is there a way to do conditional operators in Velocity?
This is what I'd like to do:
#set ($name = ($args.get(0) == "") ? "default" : $args.get(0))
Instead of chunky if-else
#if ($args.get(0) == "")
#set ($name = "default")
#else
#set ($name = $args.get(0))
#end
Any ideas?
...
Hi,
we use Velocity to template our configuration files for several different environments and this process works really well but I have a quick question relating parsing a file that doesn't exist.
My question is:
How do you check if a file exists before parsing it?
So in the example the file default.user.properties might legitimately ...
I'm asking this on behalf of one of my students - "Does anybody have an idea how to convert JSP Struts to Velocity Struts?"
...
Is it good to make Velocity Template Object Static?
The situation is im going to use this object in (Servlet) multi user environment populating different data for each user-request with same template.
...
As part of a project I'm working on, we're migrating from Velocity to JSP. I need to turn the set of existing Velocity templates into JSPs. We could spend hours discussing why this was decided (partly my fault), which one is better and the best way to dissuade management from this path, but that would be a waste of time as they are commi...
Hi All,
i am using velocity engine template for mailing in struts1 and hibernate configuration.
i got error : org.apache.velocity.exception.ResourceNotFoundException while i try to send mail.
i have included velocity1.5.jar, mail.jar, activation.jar, smtp.jar.
i include the velocity template path here
String velocityTemplate = "mail...
Hi,
I've got the following setup:
IE7 on the desktop in a corporate environment, capable of Kerberos/NTLM authentication
IIS6 with integrated windows authentication (Kerberos/NTLM) enabled
Enfold Proxy (basically, URL-rewriting/proxying) plugin in IIS enabled, proxies to a Python web application (using Paste and WSGI)
This setup pro...
Hi all,
I am trying a very simple struts2 (2.1.6) application using velocity (1.6.2 and tools 2.0 beta4) ,
It's nothing more than a simple form with a single textfield.
The code follows
## Velocity Template.
<html>
<head>
<title>Struts2 and velocity </title>
</head>
<body>
pass this me...
Can I ship my application with compiled templates?
I there such a thing at all compiled templates in velocity? Or are they obligatorily recompiled on every run?
...
So after installing UrlRewriteFilter, I set up a rule and a corresponding velocity template. And when I go to the test page, the velocity script is shown as raw code instead of being compiled.
example of the code for the rule:
<rule>
<from>/test/([0-9]+)</from>
<to>/downloads/test.vm?Id=$1</to>
</rule>
example of the urlrewrite...
What is the best way to create Velocity Template from a String?
I'm aware of Velocity.evaluate method where I can pass String or StringReader, but I'm curios is there a better way to do it (e.g. any advantage of creating an instance of Template).
...
I have hijacked the normal processing of velocity templates by calling response.getOutputStream in my controller, and I do get an image, but there is an exception "java.lang.IllegalStateException: getOutputStream() has already been called for this response" whenever an image is generated. Is there a way to tell velocity not to parse the ...
Can Velocity be configure to fail (i.e. throw an Exception) when a $var is undefined.
Such a "fail-fast" strategy would help in our testing cycles.
...
Velocity or FreeMarker?
They look pretty much the same, even the syntax?
What to use? Or when to use what?
...
Is there a way I can mark a public method as "not callable from a velocity template".
...