Use wildcards for your actions.

<action name="abc_*" method="{1} class="com.mypaysite.MyAction>

The action's alias now includes the method name. Refer to the action by it's alias matching the wildcard:

<s:submit value="button1" action="abc_methodA"/>
<s:submit value="button2" action="abc_methodB"/>

Use the validation filenames ActionClassName-alias-validation.xml: MyAction-abc_methodA-validation.xml MyAction-abc_methodB-validation.xml

References:
http://struts.apache.org/2.0.9/docs/wildcard-mappings.html

Hope that helps, Jeromy Evans

j alex wrote:
Hi,

Just checking one more time if someone has an answer to my below email. We
decided to go with XML validation, and as i understand it, we cannot have
validation files based on action methods, but can only name it by action
alias. This makes me create a new action alias entry in struts.xml for each
action method, and also change the buttons/links in jsp accordingly.

It'll be great if someone can provide inputs before i embark on this huge
refactoring.

Thanks,
Joseph

On 8/17/07, j alex <[EMAIL PROTECTED]> wrote:
Dave,

How do we use the action-alias XML approach if we've the same alias
but different methods on the same action ?

ex :

<action name="abc" class="com.mysite.myAction" />

say myAction has methodA(), methodB() etc. which are invoked using
different submit buttons in the jsp
<s:submit value="button1" method="methodA"/>
In this case, we could have myAction-abc-validation.xml , but how will
it differentiate b/n methodA and methodB?

i tried myAction-methodA-validation.xml ; but it didn't seem to work.

Thanks,
Joseph



On 8/15/07, Dave Newton <[EMAIL PROTECTED]> wrote:
--- j alex <[EMAIL PROTECTED]> wrote:
ex : if an Action has multiple methods and only
certain fields are tied to each method, we can
bunch together validations for each method
using annotations, but this is not possible using
XML
You can create validation XML files on an action-alias
basis.

d.





____________________________________________________________________________________
Got a little couch potato?
Check out fun summer activities for kids.

http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



------------------------------------------------------------------------

No virus found in this incoming message.
Checked by AVG Free Edition. Version: 7.5.484 / Virus Database: 269.12.1/963 - Release Date: 20/08/2007 5:44 PM


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to