I have my page in the package
xxx.pages
It does not matter if I put the abstract BasePage parent class to my page in
xxx.base or not. Tapestry complains about
BasePage: method <init>()V not found

If I add that constructor to my parent class the page works (almost)
as expected.

It gets even stranger since if I add the no-args constructor to the
abstract parent class but still invoke the parameterized constructor
in the parent class from the concrete page class it looks like it
doesn't set the property of the parent class.

So, is this expected behaviour?

Index.html (removed html header)
--------
<body>
<p>Superclass message set by constructor call from sub class:
${superclassConstructorMessage}</p>
<p>Superclass message set by setter in sub class: ${superclassSetterMessage}</p>
<p>Subclass message: ${subclassMessage}</p>
</body>
</html>
--------

Index.java
--------
package nu.zoom.web.reloaded.pages;

import nu.zoom.web.reloaded.base.BasePage;

public class Index extends BasePage {
        private String subclassMessage;

        public Index() {
                super("Set from subclass by: super(\"Set from subclass by: 
\");");
                setSuperclassSetterMessage("Set in subclass by setter");
                setSubclassMessage("Set by setter");
        }

        public String getSubclassMessage() {
                return subclassMessage;
        }

        public void setSubclassMessage(String subclassMessage) {
                this.subclassMessage = subclassMessage;
        }

}
--------
BasePage.java
--------
package nu.zoom.web.reloaded.base;

public abstract class BasePage {
        private String superclassConstructorMessage;
        private String superclassSetterMessage;

        public BasePage() {
                super();
        }

        public BasePage(final String superclassConstructorMessage) {
                super();
                this.superclassConstructorMessage = 
superclassConstructorMessage;
        }

        public String getSuperclassSetterMessage() {
                return superclassSetterMessage;
        }

        public void setSuperclassSetterMessage(String superclassSetterMessage) {
                this.superclassSetterMessage = superclassSetterMessage;
        }

        public String getSuperclassConstructorMessage() {
                return superclassConstructorMessage;
        }

}


On 9/19/07, Johan Maasing <[EMAIL PROTECTED]> wrote:
> Hi,
> no it was not in the root.base package. I didn't know about that one.
> Probably explains it, will try later tonight. I guess Tapestrys
> definition of POJO is a bit different from mine :-)
>
> Cheers,
> Johan
>
> On 9/19/07, Josh Canfield <[EMAIL PROTECTED]> wrote:
> > Hey Johan,
> >
> > I haven't had a need to define a custom constructor in my page classes, or
> > their base classes, I'm just use the default constructor.
> >
> > You mentioned that your base class was in "another package", but is it in
> > the special "base" package next to your "pages" package?
> > http://tapestry.apache.org/tapestry5/tapestry-core/guide/component-classes.html
> >
> > You can also use the page lifecycle methods for page level initialization.
> > http://tapestry.apache.org/tapestry5/tapestry-core/guide/lifecycle.html
> >
> >
> > Josh
> >
> > On 9/18/07, Johan Maasing <[EMAIL PROTECTED]> wrote:
> > >
> > > I was wondering if the public no-args constructor requirement on page
> > > classes also extends to their parent classes.
> > >
> > > This is my Start.html
> > > ---
> > >            [<t:pagelink t:page="Index">Index</t:pagelink>]
> > > ---
> > > My Index.html contains only static text.
> > >
> > > My Start.java is an empty POJO.
> > >
> > > My Index.java looks like this (removed package):
> > > ---
> > > public class Index extends BasePage {
> > >
> > >        public Index() {
> > >                super("Test");
> > >        }
> > > }
> > > ---
> > >
> > > The BasePage.java (in another package from my pages) looks like this:
> > > ---
> > > public abstract class BasePage {
> > >        private String title ;
> > >
> > >        public BasePage(String title) {
> > >                super();
> > >                this.title = title;
> > >        }
> > > }
> > > ---
> > >
> > > I get the following error from tapestry when rendering Start.html, it
> > > points at the pagelink line and says:
> > > java.lang.NoSuchMethodError: xxx.BasePage: method <init>()V not found
> > >
> > > If I add a public no-args constructor to the BasePage (no changes to
> > > Index.java) it does not complain . Is this expected?
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > --
> > TheDailyTube.com. Sign up and get the best new videos on the internet
> > delivered fresh to your inbox.
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to