File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes apache2 and extends Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "apache2 and extends" Watch "apache2 and extends" New topic

apache2 and extends

Glenn Timchishen

Joined: Jun 20, 2004
Posts: 21

In my research regarding struts2 I was lead to believe that struts2 did most of its work through implmenting interfaces (like springMVC) and not through extends. However when I look through examples on the web, all I see is, extends, extends, extends.

So whats the real story? Was my original research incorrect? Is struts2 still dependant on extending superclasses in order to get it's work done?

Please advise?
Joe Ess

Joined: Oct 29, 2001
Posts: 9189

From the API doc for com.opensymphony.xwork2.Action:
All actions may implement this interface, which exposes the execute() method. However, as of XWork 1.1, this is not required and is only here to assist users. You are free to create POJOs that honor the same contract defined by this interface without actually implementing the interface.

It doesn't look like you need to implement or extend anything (haven't tried it).
I assume the examples you are finding extend ActionSupport?
That's a good base class to start because it covers a lot of the basic functionality for most actions (creating action/error messages, retrieving messages by key, validation and so on), which may account for its popularity.

[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: apache2 and extends
It's not a secret anymore!