The file name for the validation file is:
{ActionName}-{AliasName}-validation.xml
In my case:
AccountAction-Payment_retrieveFee-validation.xml
Now, if I could only figure out why I am getting errors on the minlength
and maxlength of my stringlength validator:
<field name="payment.ccExpDate">
<field-validator type="requiredstring">
<message key="requiredstring"/>
</field-validator>
<field-validator type="stringlength">
<param name="minlength">4</param>
<param name="maxlength">4</param>
<message key="expDateLength"/>
</field-validator>
</field>
WARNING: Caught OgnlException while setting property 'minlength' on type
'com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator'.
ognl.NoSuchPropertyException:
com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator.minlength
Anyone?
Skip Hollowell wrote:
I had the whole validation thing working great, and then I had to go and
get 'fancy' with my Actions and aliases, and now, I can't seem to get my
validator xml files named correctly...
<!-- Use Case 01 -->
<action name="Account_*" class="com.skip.action.AccountAction"
method="list">
<result
name="success">/WEB-INF/jsp/UC01-EnterPayment.jsp</result>
<!-- we don't need the full stack here -->
<interceptor-ref name="basicStack"/>
</action>
<action name="AccountCrud_*"
class="com.skip.action.AccountAction" method="{1}">
<result
name="input">/WEB-INF/jsp/UC01-FindAccount.jsp</result>
<result
name="success-acctfound">/WEB-INF/jsp/UC01a-RetrieveFee.jsp</result>
<result
name="error-acctnotfound">/WEB-INF/jsp/UC01-FindAccount.jsp</result>
<result
name="search">/WEB-INF/jsp/UC01-FindAccount.jsp</result>
<result name="success"
type="redirect-action">Account_input</result>
<result name="success-deleted"
type="redirect-action">Account_input</result>
</action>
<action name="Payment_*" class="com.skip.action.AccountAction"
method="{1}">
<result
name="input">/WEB-INF/jsp/UC01a-RetrieveFee.jsp</result>
<result
name="list">/WEB-INF/jsp/UC01a-RetrieveFee.jsp</result>
<result
name="success-feefound">/WEB-INF/jsp/UC01b-EnterPayment.jsp</result>
<result
name="success-paymentmade">/WEB-INF/jsp/UC01b-EnterPayment.jsp</result>
<result
name="error-feenotfound">/WEB-INF/jsp/UC01a-RetrieveFee.jsp</result>
<result
name="error-paymentnotmade">/WEB-INF/jsp/UC01b-EnterPayment.jsp</result>
<result type="redirect-action">Menu</result>
<result
name="success">/WEB-INF/jsp/UC01a-RetrieveFee.jsp</result>
</action>
According to the doc:
Validation rules can be specified:
1. Per Action class: in a file named ActionName-validation.xml
2. Per Action alias: in a file named ActionName-alias-validation.xml
3. Inheritance hierarchy and interfaces implemented by Action class:
WebWork searches up the inheritance tree of the action to find
default validations for parent classes of the Action and
interfaces implemented
So I have a form that will be submitting a payment, and I want to
validate a couple fields on the form...
<form namespace="/blah" id="Payment_retrieveFee"
name="Payment_retrieveFee" onsubmit="return
validateForm_Payment_retrieveFee();"
action="/WEB/blah/Payment_retrieveFee.do" method="POST">
What do I name my validation xml file in com.skip.action?
AccountAction-valdiation.xml is too broad
AccountAction_payment-validation.xml doesn't work
AccountAction_Payment-validation.xml doesn't work
Payment-validation.xml doesn't work
I'll keep digging through Wikis, Examples and Doc, but I haven't found
it yet.
Thanks for any help
Skip
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
<http://www.nabble.com/user/SendEmail.jtp?type=post&post=9857547&i=0>
For additional commands, e-mail: [EMAIL PROTECTED]
<http://www.nabble.com/user/SendEmail.jtp?type=post&post=9857547&i=1>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]