a syntax error, so there wouldn't be a problem with
backwards compatibility. Can someone confirm that?
That would yield:
#set($bar=thingy)
#set($foo=This $bar is fine)
$foo
This thingy is fine
#set($bar=thingy)
#set($foo='This $bar is ''fine''')
$foo
This $bar is 'fine'
Barbara Baughman
. It's all there.
I have some notes to myself on setting up Velocity for a web application
that may be useful in just seeing how someone does it for real. Use this
only as another example, not the final word...
http://www.utdallas.edu/~baughman/velocity.html
Barbara Baughman
X2157
On Fri, 26 Jul
Try
(#foreach($element in $list)$element#if($velocityCount==list.size()))#else,#end
Starts with a (, then the element followed by a comma if we're not on
the last element, followed by a ) if this is the last element.
Barbara Baughman
X2157
On Wed, 28 Jan 2004, White, Joshua A (HTSC, CASD
, , incTpl);
String vtl = w.toString();
Barbara Baughman
X2157
On Thu, 20 May 2004, Ford, Peter wrote:
That might work...
I could do this in my code:
String incTpl = #include($ + tpl + );
..
Writer w = new StringWriter();
velocityEngine.evaluate(ctx, w, , incTpl);
String vtl = w.toString
I access superclass methods constantly with no problems. Just follow
the rules that Velocity only references public methods in public
classes. So A has to be public, B has to be public, and the method
has to be public.
Barbara Baughman
X2157
On Fri, 23 Jul 2004, Michael Yui wrote:
Hi,
Can
code already has the information javascript needs
from the Velocity context before sending it to the client.
Barbara Baughman
X2157
On Wed, 13 Oct 2004, Shankar Banerjee wrote:
Hi ,
We are using html and javascript for rendering an UI. We are also using
struts and velocity to interface
of the first letter after get.
Barbara Baughman
X2157
On Fri, 15 Oct 2004, Mike Kienenberger wrote:
Wong, RYM (Richard) [EMAIL PROTECTED] wrote:
Hi,
I cannot find out whether VTL is case sensitive or not in the on-line
reference manual.
e.g. Are the reference variables $var and $VaR
/info/facstaff.vm
The template output only provides one blank line, even though the
size() method indicates there are 84 members.
Any hints or tips?
Barbara Baughman
X2157
-
To unsubscribe, e-mail: [EMAIL PROTECTED
Actually, I was trying to create a class that was immutable, which
means I wouldn't want to implement Collection. If I have the class
just implement Iterator would that do it?
Barbara Baughman
X2157
On Mon, 18 Oct 2004, Simon Christian wrote:
Hi Barbara,
I believe that either your class
Well, I think I answered my own question. It's NO.
Barbara Baughman
X2157
On Mon, 18 Oct 2004, Barbara Baughman wrote:
Actually, I was trying to create a class that was immutable, which
means I wouldn't want to implement Collection. If I have the class
just implement Iterator would that do
Thanks to Simon for pointing me in the right direction.
Implementing all the methods in the Collection interface did the
trick.
Barbara Baughman
X2157
On Mon, 18 Oct 2004, Barbara Baughman wrote:
Well, I think I answered my own question. It's NO.
Barbara Baughman
X2157
On Mon, 18 Oct
to sort out what
Generics can and cannot do, in the end I think they are a BIG plus for
developers who can adapt.
Barbara Baughman
X2157
On Tue, 19 Oct 2004, Shinobu Kawai wrote:
Hi Barbara,
Actually, I was trying to create a class that was immutable, which
means I wouldn't want to implement
I don't reimplement any functions. I call on the function for the
underlying object.
Barbara Baughman
X2157
On Tue, 19 Oct 2004, Shinobu Kawai wrote:
Hi Barbara,
Actually, I was trying to create a class that was immutable, which
means I wouldn't want to implement Collection. If I have
VelocityContext context = new VelocityContext();
ListMapString, String list = new ArrayListMapString, String();
MapString, String map1 = new HashMapString, String();
map1.put(id, 1);
map1.put(name, Barbara Baughman);
list.add(Collections.unmodifiableMap(Collections.synchronizedMap(map1)));
MapString
(so many the compiler
wouldn't print all of them), I don't know that I would have bothered
with the extra classes and substantial rewrite. I'd just add generics
here and there to programs as I found the time.
Barbara Baughman
X2157
On Mon, 18 Oct 2004, Mike Curwen wrote:
So
I've been using Velocity with jdk 1.5 with no problems. I don't use
every feature, but I wouldn't anticipate any problems. I have a lot
of programs written for jdk 1.4 that run just fine in 1.5. Moreover,
the JAVA developers took great pains to make sure there would be no
problems.
Barbara
. Then you would have to create your own method in the
$car object.
#if ($car.hasFuel())
BTW, always use '==' instead of '=' when making comparisons in
Velocity.
Barbara Baughman
X2157
On Thu, 2 Dec 2004, THE ULTIMATE SUBBIAH wrote:
How to check for null in velocity
for eg. I load a class
Instead of changing the resource loader, you can have everything under
the same directory, with subdirectories for each language. Then build
the correct template name, including the appropriate subdirectory, in
your servlet.
Barbara Baughman
X2157
On Tue, 14 Dec 2004, Geercken Uwe wrote
but can choose from multiple configurations.
At least I think in theory this should be true. Never tried it.
Barbara Baughman
X2157
On Wed, 15 Dec 2004, Shinobu Kawai wrote:
Hi Stan,
Still, I think, it would be a very good idea to slightly redesign
VelocityEngine class for better support
object.
Barbara Baughman
X2157
On Thu, 20 Jan 2005, Will Glass-Husain wrote:
What problems? Can you be a bit more specific?
Again, you have a choice. You can put the Velocity jar either in
Tomcat/common/lib, or in WEB-INF/lib. With the latest set of source code,
you can then put
that would change the underlying object. Then have a
method or constructor that provides a version of the underlying class
with this boolean field set to false. Pass this immutable version of
the class to the Velocity context.
--
Barbara
servlet running.
Barbara Baughman
X2157
On Mon, 21 Feb 2005, Michael Salmon wrote:
hi folks
my templates don't load from where I want. In particular here is what
I'm doing:
1. servlet extends VelocityServlet. and calls Velocity.init(). I dont
override loadConfiguration()
2. In my webapp
. Velocity gives more
control to the programmer, providing additional tools as appropriate.
Many tool programs have already been written and are readily available
in the Velocity Tools project.
I might also add that the Velocity community is very helpful and
supportive. Super, in fact!
Barbara
This is a Tomcat problem. I find if there are too many web
applications under tomcat, at some point I get an out of memory error.
My guess is that this could be the one-more-application that broke the
camel's back.
Barbara Baughman
X2157
On Fri, 4 Mar 2005, Ryan M. Waters wrote:
I've read
());
MessageDigest md4 = MessageDigest.getInstance(MD4);
return md4.digest(s.getBytes());
}
Look up gnu.crypto in Google.
Barbara Baughman
X2157
On Fri, 18 Mar 2005, Doug Carter wrote:
Hi all,
Has anyone implemented a JDBCRealm and MD5 encrypted passwords with a
velocity app? I've
Read the User's Guide, under Quiet Reference Notation.
Barbara Baughman
X2157
On Fri, 18 Mar 2005, Madasu, Satya K. wrote:
Hi,
If I have a null value to the variable then the script is displaying as is
with the $ sign on the web page.
How to overcome this problem? Please let me know.
We
is already done.
Barbara Baughman
X2157
On Mon, 21 Mar 2005, Sanden, Steve wrote:
Hello everyone,
Just wanted to know how it might be possible to do the following:
I have a modal dialog that accepts a string value.
//simple javascript that evaluates length of a string @ submit
.
Barbara Baughman
X2157
On Tue, 29 Mar 2005, Chacko, Raj wrote:
Hi All
How to handle this sort of warning?
Velocity [warn] Warning! The iterative is an Iterator in the
#foreach() loop at 0,0] in template /data.vm. Because it's not
resetable, if used in more than once, this may lead
.
Barbara Baughman
X2157
On Wed, 30 Mar 2005, tarun Narang wrote:
hi shashi
try this too
#if(!$type)
...statements
#end
- Original Message -
From: Shinobu Kawai [EMAIL PROTECTED]
To: Velocity Users List velocity-user@jakarta.apache.org
Sent: Wednesday, March 30, 2005 10:29 PM
text - $c1{ More text
$c1{something More text - $c1{ More text
If $c1 is in the Velocity context with a value Hello, then it is
$c1{something} -Hello{
$c1{something -Hello{
$c1{something More text -Hello{ More text
Not good behavior for a templating language.
Barbara Baughman
X2157
But if $c1 is not in the context, you cannot get the following result
using Velocity no matter the Velocity code.
$c1{something}
Using your idea:
${c1}{something} - ${c1}{something}
Barbara Baughman
X2157
On Fri, 1 Apr 2005, Dimitrios Kolovos wrote:
You can always use the formal way: ${c1
, character number, and a short explanation.
Barbara Baughman
X2157
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
in the VelocityEngine, so you might also have a directory of
files that can be used by all users.
So when someone went to the user's web page, you would look up the
directory for that user, setup the appropriate VelocityEngine, set the
VelocityContext, and do a MergeTemplate.
Barbara Baughman
X2157
On Fri
Since Velocity is using Java, you have access to all of the public
methods of the classes in the java.lang package. String methods are
included.
#set ($string=TehpaoLiu)
$string.substring(0,6)
Barbara Baughman
X2157
On Wed, 25 May 2005, Liu, Teh P wrote:
Hi All,
I have a string TehpaoLiu
without worrying about messing
up base programming code. As someone who has maintained both kinds of
applications, it's no contest. Velocity wins.
Barbara Baughman
X2157
On Thu, 26 May 2005, Jason Pettiss wrote:
The real advantages Velocity has are:
- firmer separation of logic from
I use it all the time for automated email notifications.
Barbara Baughman
X2157
On Mon, 13 Jun 2005, Corbin, James wrote:
Hello,
I am starting to research Velocity as an option to create email text from a
template and wondered if this was a valid use of this tool.
It seems
, you'd be getting an
Exception message.
Barbara Baughman
X2157
On Tue, 12 Jul 2005, Withers John Z wrote:
Greetings!
I've been trying to sub-class the VelocityViewServlet to implement a web
application I've been working on. I'm pretty sure I've over-ridden the
various methods properly
they are always there.
I'm very impressed with Velocity's speed. I'm willing to trade minor
inefficiency for speed in coding.
Barbara Baughman
X2157
On Tue, 23 Aug 2005, Robert Koberg wrote:
Hi,
Say I have a VM_global_library.vm that has a macro like:
#macro (roleList)
#set ($roles = [foo, bar
the reference, but processing
continues. This is not considered to be an error but rather a
warning.
For a general purpose template, the template designer must have a list
of possible context fields and design the template accordingly.
Barbara Baughman
X2157
On Mon, 21 Nov 2005, Jitendra Kumar wrote
changes every reference to a String as it parses, so
passing binary data to Velocity for interpreation will not be useful.
Barbara Baughman
X2157
On Mon, 28 Nov 2005, Antony Bourgois wrote:
Hi
I have image data from a byte array I need to populate (append in
fact) into a template.
I've come
Class B needs to be public
public class B extends A {
Class A needs to be public
public Class A {
Barbara Baughman
X2157
On Mon, 12 Dec 2005, john oh wrote:
Hello,
I have a class (B) that extends another (A) like so
===
class A{
protected
that have precisely
what I would want to list. Another alternative is to provide a public
method to the context that will screen a larger list to a smaller list
for the #foreach directive.
Barbara Baughman
X2157
On Wed, 11 Jan 2006, Paul Gillen wrote:
Thanks for the prompt response Will. My
method to clear out the VelocityEngine?
Barbara Baughman
X2157
On Tue, 7 Feb 2006, e v a n wrote:
Hmm. I wasn't aware of the leak issue, I'll make a note of that.
As for other work arounds, I have one that will work just fine for my
situation. But I'm still curious about the specialized tiles
by printing the value of the set variable.
Barbara Baughman
X2157
On Thu, 20 Apr 2006, trad-ex wrote:
Hi All,
I tried to load property resource bundle file, but failed to get an
instance of FileInputStream.
My code is below:
#set( $fStreamClass = $util.class.forName(java.io.FileInputStream) )
#set
Try using a Map interface object like HashMap or TreeMap.
HashMapString, String hm=new HashMapString, String();
hm.put(a,apple);
hm.put(b,blueberry);
ctx.put(map,hm);
Then in Velocity:
#foreach ($key in $map.keySet())
$key $map.get($key)
#end
Barbara Baughman
X2157
On Wed, 7 Jun 2006
Cool. Thanks.
Barbara Baughman
X2157
On Thu, 8 Jun 2006, Keith R. Bennett wrote:
Barbara -
Jakarta Commons Collections has all kinds of neat classes and utilities
for this kind of thing. While unfortunately they don't support
generics, larvalabs has a product that does. The URL
http
Use !$something.
Barbara Baughman
X2157
On Fri, 16 Jun 2006, Colbert Philippe wrote:
I am writing and using Velocity macros. Inside the macro, I evaluate certain
expressions using $!somexpression. However, I noticed that Velocity
generates an empty line for each of the silent expression
try $myMap.put(123,test)
Barbara Baughman
X2157
On Wed, 19 Jul 2006, Matthias Hendler wrote:
Hello,
I try to put a key/value pair to a hashmap from velocity template.
First I put a new hashmap object into velocity context named myMap.
In my templates I can write:
...
$myMap.clear
think Velocity has anyway. I
use this quite often in HTML-based templates.
Barbara Baughman
X2157
On Fri, 4 Aug 2006, dizzi wrote:
It has probably pretty simple solution but i cant figure it anyway :)
#macro(button $name $url)
div class=buttona href=$url$name/a/div
#end
#set ($AJAXurl
to information that is specifically designated
for their use.
So you can use a tool, but I'm hoping basic Velocity would never
incorporate this.
Barbara Baughman
X2157
On Sat, 26 Aug 2006, Gyanesh M Khanolkar wrote:
Hi,
I have read in many forums for requests to read public fields ALSO incase
There could be public constants within the system that are used within
the JVM, but the programmer never meant to make them available to
outsiders. Things like allowable minimums and maximums, etc. may be
intended to be rather private.
Barbara Baughman
X2157
On Fri, 25 Aug 2006, Nathan Bubna
that automatically send the session objects
to the Velocity context.
The VelocityContext is rebuilt for every HTTP request, either
explicityly or behind the scenes. The best you can do is avoid
repopulating the vectors.
Barbara Baughman
X2157
On Wed, 30 Aug 2006, Carlo Torniai wrote:
Hi there.
I'm
I started as a newbie with Tomcat and Velocity and JAVA in the school
of hard knocks, before Struts and Click and Velocity Tools. It took a
while, but I wouldn't say it's an impossible task if you have some
time to play. I know the Velocity list will give you great help.
Barbara Baughman
X2157
My guess is because a is translated by Velocity as a String, not a
Name object.
Barbara Baughman
X2157
On Fri, 6 Oct 2006, Daryl Beattie wrote:
Hi Matthias (and Nathan),
Thanks for your quick replies.
I have changed my classes to public, and that helps a bit. Actually
also lets you share session attributes among
applications within the same instance of Tomcat.
http://server/app?parameter=something
Barbara Baughman
X2157
On Thu, 12 Oct 2006 [EMAIL PROTECTED] wrote:
I thought about that but unfortunately the value has to be passed even if
users don't use
String number=(String) request.getParameter(number);
Barbara Baughman
X2157
On Thu, 12 Oct 2006 [EMAIL PROTECTED] wrote:
Thank you all, that's what I'm looking for. Sorry about the confusion but
this is my first time using velocity, but how to do you tell the servlet
to pick up the URL
56 matches
Mail list logo