On Mon, 20 Jun 2011 07:49:01 -0300, Rizwan <rizla2...@gmail.com> wrote:
Hi
Hi!
I am trying to access a environment variable in a page. The variable is
pushed onto the environment from the enclosed component.
public class PageComponent {
@Inject
private Environment environment;
@BeginRender
Object pushObject() {
try {
Display display = new Display();
environment.push(Display.class, display);
}
@AfterRender
void popObject () {
environment.pop(Display.class);
}
}
I have tried accessing this variable in BeginRender but does not work.
It seems like the AfterRender on the component is being called before
the page.
You're describing absolutely correct and expected behavior: your component
is popping (removing) the Display object from the Environment after is
rendered, but the page is still rendering, so when the @AfterRender event
of the page is triggered the object is not there anymore.
Could someone advise on a better way of doing this?
You could not remove the object from the Environment or push and pop the
object in the page, not in the component.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org