Hi,

What I want to achieve is to migrate "EventDispatchAction", which means the
methods will be called base on event, not base on request. Single action
name can dispatch to multiple methods base on event triggered.
And I would like to know is there anyway I can configure it in the action
mapping? or I need to handle the event dispatch inside the action class?


Thanks.

Regards,
Boon Leng


nuwan chandrasoma-2 wrote:
> 
> Hi,
> 
> you can have a action mapping like this.
> 
> <action name="sample_{*}" method="{1}" ...>
> 
> and in your action class have 2 method according to you example
> 
> public String add1() {
> 
>     // your logic
> 
>     return SUCCESS;
> 
> }
> 
> public String add2() {
> 
>     // your logic
> 
>     return SUCCESS;
> 
> }
> 
> 
> if a call  like this
>     eg: /sample_add1.action the method add1 one will be called
> 
> you can get more infromation from the below link
> 
> http://struts.apache.org/2.x/docs/action-configuration.html#ActionConfiguration-WildcardMethod
> 
> Thanks,
> 
> Nuwan
> 
> ----- Original Message ----- 
> From: "Boon Leng" <[EMAIL PROTECTED]>
> To: <user@struts.apache.org>
> Sent: Saturday, July 14, 2007 4:45 AM
> Subject: Re: Migrate Struts 1 EventDispatchAction to Struts 2
> 
> 
>>
>> Hi,
>>
>> I would like to know is there any class in struts 2 which is equivalent
>> to
>> EventDispatchAction?
>> So that I can convert the following:
>>    <action path="/sample_add" parameter="insert, default=showForm" ...>
>> to something like this:
>>    <action name="sample_add" method="insert, default=showForm" ...>
>>
>> and struts 2 will call the method showForm() by default and call insert()
>> when button is clicked.
>>
>> Currently I have to dispatch the method inside my action class if I
>> maintaining the same action name.
>>
>>    public String execute() throws Exception {
>>        if (insert) {
>>            return insert();
>>        } else {
>>            return showForm();
>>        }
>>    }
>>
>> or slip the mapping into 2 actions:
>>    <action name="sample_add1" method="showForm" ...>
>>    ...
>>    <action name="sample_add2" method="insert" ...>
>>
>> Regards,
>> Boon Leng
>>
>>
>> Laurie Harper wrote:
>>>
>>> What do you specifically need help with? Struts2 supports wildcard
>>> action paths, dispatch to different methods in an action and
>>> parameterized results (equivalent to the forwards in your S1 config). Is
>>> there something in particular you're having trouble with?
>>>
>>> L.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>
>> -- 
>> View this message in context: 
>> http://www.nabble.com/Migrate-Struts-1-EventDispatchAction-to-Struts-2-tf4074633.html#a11591032
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Migrate-Struts-1-EventDispatchAction-to-Struts-2-tf4074633.html#a11599257
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to