aspose file tools*
The moose likes Struts and the fly likes execute method of ActionSupport Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "execute method of ActionSupport Class" Watch "execute method of ActionSupport Class" New topic
Author

execute method of ActionSupport Class

Girish Wakure
Greenhorn

Joined: Apr 14, 2010
Posts: 28
Hello Everyone!!

I have created action class that extends the ActionSupport class.
for some navigation action i am using following code


do i need to write execute method here?

because it is giving me following error



I was under impression that once you extend ActionSupport Class then you need not write execute() method instead it calls execute() method of ActionSupport class.


Please correct me. where I am going wrong.

Thanks.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Action source?
Girish Wakure
Greenhorn

Joined: Apr 14, 2010
Posts: 28
David Newton wrote:Action source?


I dont get it
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I didn't either. Without the action source code how I can I help?
Girish Wakure
Greenhorn

Joined: Apr 14, 2010
Posts: 28
here in this application I just want to go to another jsp page as you can see in action and result mapping
Girish Wakure
Greenhorn

Joined: Apr 14, 2010
Posts: 28
here is action class
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

hi,girish
You dont need to mention the execute() method in struts.xml .
But if you want to call a particular method other than execute then you need to mention it in the struts.xml file.


Good luck!!
A small leak can sink a Gigantic ship.>
Girish Wakure
Greenhorn

Joined: Apr 14, 2010
Posts: 28
Thanks for reply.

I just had a look at source code of ActionSupport and Action classes &
I have noticed that ActionSupport class dosent have execute() method!!


So I think I need to write execute method i.e. when I am not mentioning any method in action tag in struts.xml
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

That is not correct; see the ActionSupport Javadocs.
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

hi,

No you are not required to put execute() in action tag in struts.xml.


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

@Raza: the only time you need to write an execute() method is if (a) you don't specify a different method in the mapping and (b) you're not extending ActionSupport.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Ah--I see you're using a non-S2 plugin. Its requirements may be different, and it may be looking *only* in the specified class for an execute() method: check its source; that's almost certainly the issue.
Girish Wakure
Greenhorn

Joined: Apr 14, 2010
Posts: 28
sorry! I got my mistek.

but this dosent shows execute method so I got confused.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Er, that's a completely different class from a completely different framework for a completely different version of Struts.
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

hi Newton.

Are you Talking about mentioning it in Struts.xml or Action class ?



David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

@Raza: I'm saying that you don't need to write an execute() method if you're extending ActionSupport (since it has a default implementation) or you specify the method to be executed in a config file.
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

thanks for confirmation newton !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: execute method of ActionSupport Class