Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using Struts Validator &

 
Jonathan Goh
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I try to use Struts Validator. Javascript message (i.e alert message) is always display as blank instead of displaying the expected error message. Pls you advise what had go wrong.
If I use DynActionForms, what do I retrive the parameters in Action beside using request? Unlike using ActionForm, i can validated the parameters in ActionForm.Validated. For DynActionForms, how can I do it beside validate the parameter in Action.Execute.
 
El Roy Cabildo
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this what you are going to do...
in the validator.xml
<form name="loginForm">
<field property="badgeNo"
depends="required">
<arg0 key="app.username.text" />
</field>
<field property="password"
depends="required" >
<arg0 key="app.password.text" />
</field>
</form>

in your message resource you put this properties....
errors.required={0} is required.
app.password.text = Password
app.username.text = Username
if an error accured, the {0} will be replaced by the key in arg0 tag.
 
Gary Mann
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using a DynaValidatorActionForm, you can still perform validation in the validate() method just like a "standard" ActionForm.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic