Hi Howard,
Thanks for your reply. Yes, I updated my application specification to identify the new engine subclass to instantiate. Why is the engine constructor not called ? I think engine constructor is the best place to do initialization.
I guess page constructor is not the right place to do what I am doing, isn't it ? In the absence of constructors not working, I have to either keep track of whether engine::init() has been called by any listener method or create/destroy the database connection in each listener method. Both approaches don't look good, is there a better approach ?
Thanks,
Aejaz
"Howard M. Lewis Ship" <[EMAIL PROTECTED]> wrote:
You did update your application specification to identify the new engine
subclass to instantiate, right?
The page constructor: the page is loaded (instantiated, then configured)
first, then attached to the engine, so a call to getEngine() returns null
inside the constructor. You're probably getting a NPE from your
constructor; you should see this in the exception report.
I tend to just lazily create things as needed, rather than pre-create them.
----- Original Message -----
From: "Aejaz Muslim" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 28, 2002 11:41 PM
Subject: [Tapestry-developer] Engine/Page constructor question
>
> Hi,
>
> I am extending from SimpleEngine & want to provide a constructor for my
Engine class where I want to initialize database connection & construct some
PreparedStatements, but this constructor is never called(This is a no
argument constructor). I wanted to do the same at page level by providing a
constructor for a page(Home) where I made a call to getEngine() & init()
method of my Engine class but I got an Exception which said that Tapestry
couldn't create the
> instance for the Home page.
>
> Is this the right way to do what I am doing ? Please let me know.
>
> Thanks,
>
> Aejaz
>
>
>
>
>
>
>
> ---------------------------------
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
