Meaningless Drivel is fun!
The moose likes Struts and the fly likes how to inherit a class in Action class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to inherit a class in Action class" Watch "how to inherit a class in Action class" New topic

how to inherit a class in Action class

samir ware
Ranch Hand

Joined: Jul 27, 2005
Posts: 192
hi ,
I come across the problem of inheriting the class in an Action class.
As per the struts frame work implementation the actoin class implemaenation should be as follows

class DbAction extends Action {

that means my action class(DbAction) should inherit the Action class. But what if I want to extend one more class in DbAction.
for eg . suppose I have a class DataBase that has the methods for connecting to database, releasing the connection ,firing any queary etc. and all these methodes are PROTECTED.
so in order to access these methodes I should extend the class DataBase in DbAction . But my DbAction already extends Action and its not possible to extend more than two classes in java.
So how shouls I proceed.
Plzzzzzzzzzz let me know the solution for the same.
Thanks in advance,

vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
hi samir

Have a model class which extends ur Db class.

Then make a call from ur action class to your model class
I agree. Here's the link:
subject: how to inherit a class in Action class
It's not a secret anymore!