简体   繁体   中英

Calling a different method instead in 'execute' in Struts 1.2

In struts 1.2, when an URL in the form http://foo.com/barAction.do is invoked, this will call the execute method (or process ) in the action class that was mapped to barAction .

Is it possible to call a different method other than the execute (or process ) in the same action class when the above URL is invoked?

You can use a DispatchAction . Basically they allow you to choose which method will be invoked based on a request parameter or action mapping configuration

There are at least 3 "flavours" of DispatchAction: EventDispatchAction, LookupDispatchAction, and MappingDispatchAction.

I'd recommend you to take a lookt at EventDispatchAction that was introduced in Struts 1.2.9.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM