You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Nicholas Lesiecki <nl...@vmsinfo.com> on 2004/10/13 19:17:28 UTC

How to initialize engine programmatically?

Hello Tap-gurus,

 

I'm working (yet again) on Tapestry-Struts integration. I'd like to be able
to call a method on the visit from my Struts classes. So far, so good. So, I
get a reference to the session, look up the engine, and then call getVisit()
on it. There I run into two problems:

 

1)       I have no way of guaranteeing that the session contains an Engine
at this point (I already have several objects in session, so I have a
working Session).

2)       I have no way of guaranteeing that getVisit() will actually return
a visit (unless I call getVisit(cycle) which is hard without a cycle)

 

I worked around issue 2 by creating my own Engine which will always create a
visit when asked for one. Issue 1 is a little more complicated. Right now, I
plan to solve it by using a RequestDispatcher to include a blank tapestry
page which will cause the engine to be automatically initialized. I don't
like this solution because it's indirect and confusing. Is there a way to
init the engine programmatically?

 

Thanks for your help,

Nick