velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Charles N. Harvey III" <charl...@alloy.com>
Subject RE: [veltools] struts+validator error keys Was: commons validator elements
Date Tue, 01 Apr 2003 20:25:58 GMT
Ok.  I have figured out why I am not getting any error messages.
My toolbox is not loading up.  And I am not getting any crazy errors.
I am seeing this in my log file:

2003-04-01 15:39:19  Velocity   [info] No toolbox entry in configuration.

That's the only thing that tells me my toolbox isn't working.

Besides this in the web.xml:
<servlet>
	<servlet-name>velocity</servlet-name>

<servlet-class>org.apache.velocity.tools.view.servlet.VelocityViewServlet</s
ervlet-class>
	<init-param>
		<param-name>toolbox</param-name>
		<param-value>/WEB-INF/toolbox.xml</param-value>
	</init-param>
	<load-on-startup>20</load-on-startup>
</servlet>

And putting the toolbox.xml file in WEB-INF I don't know what else
I should be doing to get it to startup.  It _used_ to.  Any idea on
why it would stop working?  There must be something I have done, me
being such a toolbox.


Charlie


-----Original Message-----
From: Nathan Bubna [mailto:nathan@esha.com]
Sent: Monday, March 31, 2003 6:25 PM
To: Velocity Users List
Subject: [veltools] struts+validator error keys Was: commons validator
elements


Charles said:
> Hello all you Struts/Velocity users.
> I am using struts with velocity and I have implemented the commons
> validator.
> Works pretty well I must say.  And fast.

glad to hear it.

> Thing is, I am not sure how to
> access the error strings from Velocity.  And nowhere on the validator site
> does it really tell me where these messages go.

did you check the archives for this list?
i'm pretty sure i sent a long example email some time back.

> Are they coming from the request?  session?  So:
> $errors.prefix $error $error.suffix
>
>     Or
> $request.errors.prefix ....

you should be using the ErrorsTool to deal with these.  if you are, then you
should be doing something like:

#foreach( $e in $errors.foobar )
<span class="error">$e</span>
#end

where "foobar" is the name of the field being validated.  if you do not wish
to display field validation errors individually, you can always just do:

#foreach( $e in $errors.all )
<span class="error">$e</span>
#end

> You get the idea.  Where do they come from.

with Struts, it's my understanding that all ActionError instances go in the
ActionErrors object for the request.  when using Validator, then the
ActionError objects associated with a field being validated should be put
into ActionErrors using the fieldname as the key.

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message