aspose file tools*
The moose likes Struts and the fly likes  html:errors tag not displaying errors :-( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark " html:errors tag not displaying errors :-(" Watch " html:errors tag not displaying errors :-(" New topic
Author

html:errors tag not displaying errors :-(

Rahul Kakkar
Ranch Hand

Joined: Apr 17, 2005
Posts: 70
ello All,

When I attempt to display my ActionErrors (created in the validate method) I get the <li> </li> tags (dot) but, the error message is not displayed.
I checked the classes directory to ensure that the application.properties file was there and it is.....HELP

AppMessages.properties
errors.header=<font color="red"><h2>Error!</h2><UL>
errors.prefix=<LI>
errors.suffix=</LI>
errors.footer=</UL></font>

prompt.db.driver=JDBC Driver
prompt.db.url=JDBC URL
prompt.db.username=Username
prompt.db.password=Password
prompt.db.query=SQL Query
error.required={0} is mandatory
error.query.select.allowed=Only SELECT query is allowed


validation.xml:

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">
<form-validation>
<formset>
<form name="DBInfoForm">
<field property="driver" depends="required">
<arg0 key="prompt.db.driver"/>
</field>
<field property="url" depends="required">
<arg0 key="prompt.db.url"/>
</field>
<field property="query" depends="required">
<arg0 key="prompt.db.query"/>
</field>
</form>
</formset>
</form-validation>


HTML DISPLAY CODE
<p><html:errors/></p>


web.xml:

<init-param>
<param-name>application</param-name>
<param-value>AppMessages</param-value>
</init-param>

struts-config.xml:

<message-resources parameter="AppMessages"/>
Pranav Sharma
Ranch Hand

Joined: Oct 27, 2003
Posts: 258
try setting the jsp to javascript alerts, and see if the errors are getting detected
Srilakshmi Vara
Ranch Hand

Joined: Jul 21, 2004
Posts: 169
For validation to work

--- check validate tag must set to be true in action mapping class.
--- Your form should extend ValidatorForm.

Srilakshmi
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Look at your validator-rules.xml configuration. I'm pretty sure the "required" error message key it expects is errors.required


A good workman is known by his tools.
Vicky Mohan
Ranch Hand

Joined: Oct 14, 2004
Posts: 130
Marc is right.

your Resource Bundle should be having that entry (errors.required).

I had the same issue sometimes ago ..
[ August 26, 2005: Message edited by: Mohen Vijay ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html:errors tag not displaying errors :-(