You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Federico Fanton <ff...@ibc.it> on 2007/07/27 15:05:34 UTC
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!
RE: DefaultPageFactory doesn't find constructor in base class
Posted by Maeder Thomas <th...@ecofin.ch>.
Constructors are simply not inherited in Java. You need to define one on
all subclasses.
Thomas
-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Federico Fanton
Sent: Freitag, 27. Juli 2007 15:06
To: wicket-dev@incubator.apache.org
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!