You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Peter Romianowski <me...@gmx.de> on 2002/06/14 16:45:53 UTC

End Template-Rendering from within a template

Hi,

I want to add Velocity-Support to my validation-framework. This framework
is mostly used for Request-Parameter-Validation but for other things, too.

I want to enable something like this:
...
	<validator name="isEmail" class="VelocityValidator">
		<param name="email" required="true"/>

		#if ($email.indexOf ('@') == -1) 
			#return (false "An Emailaddress must contain '@'")
			## end rendering at this point!
		#end
		#if ($email.length() < 5)
			#return (false "Too short")
		#end

		and so on

	</validator>
...

Can I stop rendering within the macro #return? In this example I could
have mimic this feature using an #else-statement I know, but this is only
a simple example.

And is there a method that can build a template (with parsed tree) from
String / Reader. I remember Geir intended to implement such thing. I would
really love to see this (perhaps in 1.3?) :)

I really find velocity usefull for more than just rendering of webpages. I
already use it for mail-templating, pdf-generating (using fop) and I would
like to use it for use cases like validation and dynamic SQL-Statements. 

btw: Will the long/double issue be solved in 1.3? It's the only kinda "showstopper"
for me right now.

So, good god - good job!

Peter


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>