GeeCON Prague 2014*
The moose likes Struts and the fly likes validation-blank pop up window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "validation-blank pop up window" Watch "validation-blank pop up window" New topic
Author

validation-blank pop up window

natasa jones
Ranch Hand

Joined: Aug 20, 2006
Posts: 45
i am trying to use struts validator,but i am having the following problem.the alert window pops up,but there is no text in it!!

my code in validation.xml is :
<form name="registerForm">
<field property="firstName"
depends="required">
<arg0 key="register.message.name"/>
</field>
i have <message-resources> in struts-config and it works fine in other cases but not in this one!
i havent made any changes in validator-rules.xml.
can anyone help???
Vijendra Babar
Greenhorn

Joined: Jul 28, 2006
Posts: 18
Hi,

As you have specified <arg0 key="register.message.name"/> tag in your .xml file, you need to first check wether there is any message present in your ApplicationResourses.properties file.

Put this line in .properties file
register.message.name={0} is required.

This will prompt alert message saying "--Field Name-- is required"

Hope so your problem is solved.
natasa jones
Ranch Hand

Joined: Aug 20, 2006
Posts: 45
Hi!
actually,my mistake was that i believed that errors.required which is the value of msg in validator-rules.xml already exists as an expression!Something like: errors.required={0} is a required field.
therefore i didnt write these messages myself and finally nothing appeared in the window!!
in .properties i have now errors.required and also:
register.message.name=name,register.message.surname=surname etc,so now in place of {0} of the error.required it puts name,or surname as i wanted!
thanks for your help anyway!
 
 
subject: validation-blank pop up window