You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andrey Tkach <tk...@sac.com.ua> on 2005/06/08 15:50:30 UTC

Visit obj initialization

Hi,

I have Visit class that is declared in web.xml in <servlet> section
    <init-param>
		<param-name>org.apache.tapestry.visit-class</param-name>
		<param-value>some.path.project.tapestry.Visit</param-value>
	</init-param>
When I try to reach in from some page class (from BasePage), everything is
ok.
	Visit visit = (Visit) getVisit();    

The problem appear when I try to get Visit object in a component. For
example Border.

Here is the listener method from the Border.java (Example from Tapestry in
Action)

public void login(IRequestCycle cycle)
{
           Visit visit = (Visit) cycle.getEngine().getVisit(); <<Always NULL
           if (visit != null && visit.isUserLoggedIn()) 
           return;
.
}
Q. How to initialize Visit to be accessed from not only pages but also
components? 

Thank you much,
Vielen Dank,
:)

Andrey


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Visit obj initialization

Posted by Justin Koke <ju...@gmail.com>.
Actually you can just go:

Visit visit = (Visit) getPage().getVisit();

On 6/8/05, Justin Koke <ju...@gmail.com> wrote:
> Andrey asked:
> > Q. How to initialize Visit to be accessed from not only pages but also
> > components?
> 
> If Border.java is a component (ie it extends BaseComponent), you can
> just use the following:
> 
> Visit visit = (Visit) getPage().getEngine().getVisit();
> 
> Cheers,
> Justin
> 
> --
> Justin Koke
> E: justinkoke@gmail.com
> 


-- 
Justin Koke
P:+61 2 9288 7579
M: 0402 045 101
E: justinkoke@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Visit obj initialization

Posted by Justin Koke <ju...@gmail.com>.
Andrey asked:
> Q. How to initialize Visit to be accessed from not only pages but also
> components?

If Border.java is a component (ie it extends BaseComponent), you can
just use the following:

Visit visit = (Visit) getPage().getEngine().getVisit();

Cheers,
Justin

-- 
Justin Koke
E: justinkoke@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org