Dale Newfield wrote:
Allen Gilliland wrote:
I tried out using the validation annotations to only validate a
specific action method but the result is the same, it just does the
validation on all methods :/
I use the ActionName-methodName-validation.xml technique.
Would you mind sharing a couple details about how you have it
configured, because if it's working for you then I suppose I must be
doing something wrong? I am using Struts 2.0.5.
What I have in my struts.xml file is ...
<action name="MyForm!*" method="{1}" class="mypackage.MyForm">
<result name="input">/WEB-INF/jsps/MyForm.jsp</result>
</action>
Using this I can access MyForm.action to get to the default view showing
an empty form, and I can post the form to MyForm!save.action and it
executes the save() method on my action.
Then in mypackage I have a file called MyForm-save-validation.xml with
this in it ...
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator
1.0.2//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
<field name="property">
<field-validator type="requiredstring">
<param name="trim">true</param>
<message>property is required</message>
</field-validator>
</field>
</validators>
If I define just MyForm-validation.xml it works as expected and is
called to validate on all methods used on the action, but nothing
happens when I just have the MyForm-save-validation.xml file.
Just because the ActionName-validation.xml file is no longer in your
.war doesn't mean it's been removed from the directory tree where your
container expands stuff...
True, but that's why I clean that out each time I update my app.
Besides, my real problem is not that the 2 files are conflicting with
each other, it's that when I just have a
ActionName-MethodName-validation.xml file then nothing happens. No
validation on that action at all.
-- Allen
-Dale
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]