Is it possible in Struts 2 to set up the visitor validator with a ModelDriven action to have a variable context parameter, like so:
I tried this code and I created a "public String getMyContext()" method in my action. However, the method never got called. I don't know if the the context has to be explictly defined or not, and I haven't been able to find anything about it after searching the web.
The goal is to to have some conditional validation at the model level. For instance, say you were creating a new employee. You might have a radio button on your page that let you choose whether you were entering an American street address or a Canadian street address, and you'd want to validate the addresses differently. In addition, you wouldn't want to make any of the American street address fields required because they'd all be blank when you hit the submit button.
Using this, I could return a context of "american" or "candian" and have a Employee-american-validation.xml file and a Employee-canadian-validation.xml file.
Any help would be appreciated.
Joined: Oct 27, 2009
Does anyone have any information on this, or, do I need to give some other information to help anyone out?