You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Skip Hollowell <sk...@skipdaddy.com> on 2007/04/05 17:02:23 UTC

[S2] Validation setup

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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] Validation setup

Posted by Dave Newton <ne...@yahoo.com>.
--- Skip Hollowell <sk...@skipdaddy.com> wrote:
> I had the whole validation thing working great, and
> then I had to go and get 'fancy' with my Actions and

> aliases, 

That'll teach ya'!

> AccountAction_payment-validation.xml doesn't work
> AccountAction_Payment-validation.xml doesn't work

Are the underscores typos?

> Payment-validation.xml doesn't work

Is that in the package containing the Payment class? 

(Haven't played with validation like that much; I
prefer action[-method] validation almost all the
time.)

d.



 
____________________________________________________________________________________
It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org