You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Leonardo Quijano Vincenzi <le...@dtqsoftware.com> on 2005/09/05 20:04:38 UTC

Page instance variables

Just 2 quick questions:

1) Is it allowed to put instance variables on a Tapestry Page? Such as:

public abstract class SomePage extends Basepage {
    private int someField;

}

I guess there are issues with concurrent access, but I couldn't find any 
definite source on this (a FAQ entry maybe?).
If I can't put it that way, then I'd have to declare getters and setters 
for every property I want to modify, right?

2) Should all page properties be abstract? Or I can declare a concrete 
property like this:

public String getSomeProperty() {
  return String.format("...", getAnotherProperty());
}

I guess this property isn't modified on the dynamic page subclass.

-- 
Ing. Leonardo Quijano Vincenzi
Director Técnico
DTQ Software




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


Re: Page instance variables

Posted by Tomáš Drenčák <to...@gmail.com>.
implement PageBeginREnderListener and then in pageBeginRenderListener
you should do initialization

2005/9/6, Leonardo Quijano Vincenzi <le...@dtqsoftware.com>:
> Seems like initialize() is deprecated. What's the correct way of
> initializing instance variables for T4?
> 
> --
> Ing. Leonardo Quijano Vincenzi
> Director Técnico
> DTQ Software
> 
> 
> Patrick Casey escribió:
> 
> >       Each thread gets its own unique copy of a page. It's not guaranteed
> >to be the *same* page each time a given user hits a page, but it's unique
> >within the context of that request so there are no problems with concurrent
> >access.
> >
> >       That being said, I make all my variables concrete because of my
> >innate, unnatural, and fogeyish fear of "fing magic" solutions that
> >automatically enhance my classfiles. The only gotcha is that you have to
> >re-initialize your instance variables to defaults when the page goes back
> >into the pool. So just make sure you implement the initialize() method on
> >your page.
> >
> >       --- Pat
> >
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

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


Re: Page instance variables

Posted by Leonardo Quijano Vincenzi <le...@dtqsoftware.com>.
Seems like initialize() is deprecated. What's the correct way of 
initializing instance variables for T4?

-- 
Ing. Leonardo Quijano Vincenzi
Director Técnico
DTQ Software


Patrick Casey escribió:

>	Each thread gets its own unique copy of a page. It's not guaranteed
>to be the *same* page each time a given user hits a page, but it's unique
>within the context of that request so there are no problems with concurrent
>access.
>
>	That being said, I make all my variables concrete because of my
>innate, unnatural, and fogeyish fear of "fing magic" solutions that
>automatically enhance my classfiles. The only gotcha is that you have to
>re-initialize your instance variables to defaults when the page goes back
>into the pool. So just make sure you implement the initialize() method on
>your page.
>
>	--- Pat
>  
>



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


RE: Page instance variables

Posted by Patrick Casey <pa...@adelphia.net>.
	Each thread gets its own unique copy of a page. It's not guaranteed
to be the *same* page each time a given user hits a page, but it's unique
within the context of that request so there are no problems with concurrent
access.

	That being said, I make all my variables concrete because of my
innate, unnatural, and fogeyish fear of "fing magic" solutions that
automatically enhance my classfiles. The only gotcha is that you have to
re-initialize your instance variables to defaults when the page goes back
into the pool. So just make sure you implement the initialize() method on
your page.

	--- Pat

> -----Original Message-----
> From: Leonardo Quijano Vincenzi [mailto:leonardo@dtqsoftware.com]
> Sent: Monday, September 05, 2005 11:05 AM
> To: Tapestry users
> Subject: Page instance variables
> 
> Just 2 quick questions:
> 
> 1) Is it allowed to put instance variables on a Tapestry Page? Such as:
> 
> public abstract class SomePage extends Basepage {
>     private int someField;
> 
> }
> 
> I guess there are issues with concurrent access, but I couldn't find any
> definite source on this (a FAQ entry maybe?).
> If I can't put it that way, then I'd have to declare getters and setters
> for every property I want to modify, right?
> 
> 2) Should all page properties be abstract? Or I can declare a concrete
> property like this:
> 
> public String getSomeProperty() {
>   return String.format("...", getAnotherProperty());
> }
> 
> I guess this property isn't modified on the dynamic page subclass.
> 
> --
> Ing. Leonardo Quijano Vincenzi
> Director Técnico
> DTQ Software
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org




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