• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

execute method of ActionSupport Class

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Action source?
 
Girish Wakure
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

David Newton wrote:Action source?



I dont get it
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't either. Without the action source code how I can I help?
 
Girish Wakure
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is action class
 
Ranch Hand
Posts: 247
MyEclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Girish Wakure
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is not correct; see the ActionSupport Javadocs.
 
Raza Mohd
Ranch Hand
Posts: 247
MyEclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

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


 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry! I got my mistek.

but this dosent shows execute method so I got confused.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Er, that's a completely different class from a completely different framework for a completely different version of Struts.
 
Raza Mohd
Ranch Hand
Posts: 247
MyEclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Newton.

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



 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@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
Posts: 247
MyEclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for confirmation newton !
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!