Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

html:errors tag not displaying errors :-(

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"/>
 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try setting the jsp to javascript alerts, and see if the errors are getting detected
 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For validation to work

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

Srilakshmi
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at your validator-rules.xml configuration. I'm pretty sure the "required" error message key it expects is errors.required
 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic