struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken McWilliams <ken.mcwilli...@gmail.com>
Subject Re: Struts Validation
Date Fri, 13 Dec 2013 23:18:45 GMT
Have the action extend ActionSupport and have the class implement its own:
public validate(void).

Look at the code of ActionSupport (or JavaDoc) for how to set error
messages, if an error is set, after validate() executes, Struts2 will
assume an error has occurred and the action will return "input".

This can be used in conjunction with the xml. Sometimes code just makes
more sense.


On Fri, Dec 13, 2013 at 6:13 AM, Vibhuti Pithwa <vibhutipithwa@gmail.com>wrote:

> Hello,
>        I had successfully written a conditional visitor validator for a
> List<Employee> in a
> validation.xml for a list of Object say Employee. Then I wrote a
> validation.xml of the
> type Employee-validation.xml where i wrote the validation to be done for
> say First
> Name , Last Name. Now the validations in Employee-validation.xml are
> executed as many times as there are objects the list List<Employees>.
> Now i have a Map of objects and i tried to write similar thing for it but
> it does not
> work. Has anyone tried doing such for a Map and can explain me an approach
> to do
> it.? This is appearing way out of my reach as we need optimised code that
> can
> iterate over the map and do validation instead of writing hard coded
> validation.Need
> some help.
>
> Thanks,
> Vibhuti Pithwa
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message