Constructors are simply not inherited in Java. You need to define one on
all subclasses.

Thomas

-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Federico Fanton
Sent: Freitag, 27. Juli 2007 15:06
To: [EMAIL PROTECTED]
Subject: DefaultPageFactory doesn't find constructor in base class

Hi everyone!
I'm having a little problem.. I'd like to have all my page classes as
extensions of a common class (BasePage), which in turn extends WebPage..
The reason is that I need every page to inherit the same PageParameters
constructor, so I have something like:

abstract public class BasePage extends WebPage {
   public BasePage() {
      // Constructor for test purposes
   }

   public BasePage(PageParameters params) {
      // Do something
      customInit();
   }

   abstract public void customInit();
}

public cass ActualPage extends BasePage {
   @Override
   public void customInit() {
      // Do something else
   }
}

Everything is fine, except that when I try to request ActualPage,
DefaultPageFactory cannot find the PageParameters constructors and falls
back to the default one... I think this is because of
http://bugs.sun.com/bugdatabase/view_bug.do;?bug_id=4287725
(I'm using Wicket 1.2.6, but if I'm not mistaken this affects beta2
also) So I was wondering.. Is this a known problem? ^^; Am I trying to
do Something Wrong maybe? And if not, could I try to submit a patch with
a workaround?
(I know I could add a PageParameters constructor to every extended
class, but I'd like to avoid it, if possible)

Many thanks in advance!

Reply via email to