velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin Mannering" <Robin.Manner...@promap.co.uk>
Subject RE: Displaying Errors
Date Fri, 18 Mar 2005 09:59:32 GMT
Hi,

Please excuse this thread.  I had another application.properties file lurking in my classpath
that was being read rather than the one that I was updating.

So, it looks as if Velocity will output the properties key if it can't find a value for the
key.

Cheers

Robin

-----Original Message-----
From: Robin Mannering [mailto:Robin.Mannering@promap.co.uk]
Sent: 18 March 2005 09:54
To: velocity-user@jakarta.apache.org
Subject: RE: Displaying Errors



Hi all,

I'm just in the process of moving over to the velocity world (from JSP tags world), so please
excuse if I'm doing something obviously wrong.

Basically, I'm trying to display form errors in relevant parts of the interface using the
following code snippet:

		#if ($errors.exist("firstNameError"))
			<tr>		
				<td colspan="2">
					$errors.getMsgs("firstNameError")	
				</td>
			</tr>
		#end

Now, the strange things is, that the following appears in the HTML output: 

	error.firstName.required 

Rather than the message as defined in application.properties as:

	error.firstName.required=Please give us your first name.

It's being set within the struts form validate() by :

		ActionErrors errors = new ActionErrors();
        
            if ((firstNameDisplay == null ) || (firstNameDisplay.length() < 2)) {
               errors.add("firstNameError", new ActionError("error.firstName.required"));
            }
		
		return errors;

Does anyone have any ideas as to why this is being output as 'error.firstName.required' rather
than 'Please give us your first name.' ???

The velocity #if statement is evaluating to true so I'm a bit stumped....

Any clues greatly appreciated, many thanks Robin

====================================================================
This e-mail and any attachments may be confidential and/or legally
privileged. If you have received this e-mail and you are not a named
addressee, please inform Landmark Information Group on 01491 413030
and then delete the e-mail from your system. If you are not a named
addressee you must not use, disclose, distribute, copy, print or rely 
on this e-mail. This email and any attachments have been scanned for
viruses and to the best of our knowledge are clean. To ensure 
regulatory compliance and for the protection of our clients and 
business, we may monitor and read e-mails sent to and from our 
servers.


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


====================================================================
This e-mail and any attachments may be confidential and/or legally
privileged. If you have received this e-mail and you are not a named
addressee, please inform Landmark Information Group on 01491 413030
and then delete the e-mail from your system. If you are not a named
addressee you must not use, disclose, distribute, copy, print or rely 
on this e-mail. This email and any attachments have been scanned for
viruses and to the best of our knowledge are clean. To ensure 
regulatory compliance and for the protection of our clients and 
business, we may monitor and read e-mails sent to and from our 
servers.


---------------------------------------------------------------------
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