saoj
Joined: 10/01/2008 08:20:15
Messages: 39
Offline
|
You can set the ValidatorFilter as a global filter so that all actions that implement the Validatable interface will be validated.
And the internationalized messages would be inside the /validation/MyAction_loc.i18n file, where loc is the locale (ex: MyAction_en_US.i18n). OBS: If you are using a master i18n file through LocaleManager.useMasterI18N(true), then your messages will be inside the /i18n/master_en_US.i18n.
Now if you don't want to put your messages in a separate file, then you can just hardcode your messages:
Now to display your message in the JSP, you can use the menta tag. You can choose from mtw:hasError and mtw:outError tag.
Note that this tags are conditional tags, in other words, nothing will be shown if there is no error for the field.
To add the ValidatorFilter as a global filter in the application manager you can just do that:
TIP: Use the Mentawai HTML form tags mtw:input, mtw:select, etc. so you don't have to worry about re-displaying the values that the user typed in case of validation error. We know you don't want to place a bunch of scriptlets in your JSPs to do this.
|