The Enviroment is tied to a ThreadLocal in the Request, so if you don't pop MyData manually, it should be cleared out automatically when the Request ends.
I'm not sure why MyData is not found on the Environment Stack - does getData() return an actual object or a null? Steve. On 27 October 2011 15:11, Bo Gao <eli...@gmail.com> wrote: > I have a 2 nested component. > I pass Parameters Using @Environmental service. > > Code in Outer Component: > > void beginRender() { > environment.push(MyData.class, data); > } > void afterRender() { > environment.pop(MyData.class); > } > > Code in inner Component > > @Environmental > private MyData data; > > > It works well. > > Then I want to put my first component in an ProgressiveDisplay, > When should I call environment.push() ? > > I try like this: > > In my outer Component: > > @OnEvent(EventConstants.PROGRESSIVE_DISPLAY) > void onLoad() { > environment.push(MyData.class, getData()); > } > > > I think this would work, but if it works, where should I call > environment.pop()? > > I got an Error: > > org.apache.tapestry5.ioc.util.UnknownValueException > No object of type org.test.MyData is available from the Environment. > availableValues > Environmentals: > > org.apache.tapestry5.RenderSupport > org.apache.tapestry5.ValidationDecorator > org.apache.tapestry5.internal.services.DocumentLinker > org.apache.tapestry5.services.ClientBehaviorSupport > org.apache.tapestry5.services.FormSupport > org.apache.tapestry5.services.Heartbeat > org.apache.tapestry5.services.javascript.JavaScriptSupport > org.test.MyData > > It's strange that It says MyData not found, but there are MyData in > availableValues. > > Many Thanks. > > -- > Bo Gao > eli...@gmail.com > > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org