tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dany <du...@hotmail.com>
Subject Re: Tapestry 5.2 - Request data shared in different client browser
Date Fri, 04 Mar 2011 09:11:59 GMT
Hi,

Ok i provide you an example. Our objective is to build small component like
personal data, address etc... This small components are included in a Page.
Page will controller the validation for all components and general events.

For example:Page Tml



>    
>      
>      
> ....
> 


Page POJO
public class NewPage 
{
	
	@Component(id="newForm")
	private Form newContractParticularPage;
	
	@Property
	@Persist
	private PersonalDataVo _personalDataVo;
...
}


The first problem that you can faced it that the variable _personalDataVo
has to be initializes the first time. Ok, you can do it is initializes the
Value Objects in the pageLoaded Method, but it is not enoug because if you
have a singleton page  the data blood for all request once one user fill up
this value Object. How to avoid, let see the components part. If you realize
we have machting tesfield with t:value="personalDataVo.nombre". if you see
the code for Java component at the end we make responsible for
initialization of Value Object to the component throught to the
setupInializes.


personalDataCmp TML


> 
> 
> 
> 


personalDataCmp POJO

public class PersonalDataCmp
{
	
	@Property
	@Parameter(required= true)
	private PersonalDataVo personalDataVo;
	
    @SetupRender
    void initializeValue()
    {

   		if (personalDataVo==null)
   			personalDataVo=new PersonalDataVo();
    }


...
}


This works an data don´t blood in requester but at the you have to controll
in your code. We follow this pattern because our application is complex and
we have to make component, following 3 layers (with EJB (business logic) +
hibernate ) and not two like is orientated tapestry. For this reason we need
indenpendance ValueObject (POJO) as databag to call EJB part and to reduce
the complex in tapestry POJO. 


In this structure at the end we have problems in the comunication between
components and Pages events + validations as well as data blood as we
disccuss in this thread. I am not an expert in tapestry but I think that
data blood problems will have been controlled by the framework like it was
controlled  in the version 5.01 or to clarify that the tapestry 5.2  has
changed become from a POJO to a tipically in a Servlet.


In other hand thanks for your help and quick reply.

Get in touch...

Kind Regards
 










Howard Lewis Ship wrote:
> 
> To reiterate: your code was broken in 5.1, just not as obviously as in
> 5.2.
> On Wed, Mar 2, 2011 at 3:06 AM, Thiago H. de Paula Figueiredo
>  wrote:
>> On Tue, 01 Mar 2011 23:30:42 -0300, Dany  wrote:
>>
>>> Hi,
>>
>> Hi!
>>
>>>        @Property
>>>        Private LoginVo loginVo;
>>>
>>>        @Log
>>>        @PageLoaded
>>>        void pageLoaded()
>>>        {
>>>                loginVo =new LoginVo();
>>>        }
>>
>> @PageLoaded is triggered just once, when the page is instantiated. As
>> Howard
>> said, since 5.2, Tapestry has just one instance of each page and its
>> state
>> is stored in a per-request Map instead of the fields themselves. Just use
>> onActivate() or @SetupRender instead and your problem will go away.
>>
>> --
>> 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-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator of Apache Tapestry
> 
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
> 
> (971) 678-5210
> http://howardlewisship.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

Howard Lewis Ship wrote:
> 
> To reiterate: your code was broken in 5.1, just not as obviously as in
> 5.2.
> 
> On Wed, Mar 2, 2011 at 3:06 AM, Thiago H. de Paula Figueiredo
>  wrote:
>> On Tue, 01 Mar 2011 23:30:42 -0300, Dany  wrote:
>>
>>> Hi,
>>
>> Hi!
>>
>>>        @Property
>>>        Private LoginVo loginVo;
>>>
>>>        @Log
>>>        @PageLoaded
>>>        void pageLoaded()
>>>        {
>>>                loginVo =new LoginVo();
>>>        }
>>
>> @PageLoaded is triggered just once, when the page is instantiated. As
>> Howard
>> said, since 5.2, Tapestry has just one instance of each page and its
>> state
>> is stored in a per-request Map instead of the fields themselves. Just use
>> onActivate() or @SetupRender instead and your problem will go away.
>>
>> --
>> 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-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator of Apache Tapestry
> 
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
> 
> (971) 678-5210
> http://howardlewisship.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

Howard Lewis Ship wrote:
> 
> To reiterate: your code was broken in 5.1, just not as obviously as in
> 5.2.
> 
> On Wed, Mar 2, 2011 at 3:06 AM, Thiago H. de Paula Figueiredo
>  wrote:
>> On Tue, 01 Mar 2011 23:30:42 -0300, Dany  wrote:
>>
>>> Hi,
>>
>> Hi!
>>
>>>        @Property
>>>        Private LoginVo loginVo;
>>>
>>>        @Log
>>>        @PageLoaded
>>>        void pageLoaded()
>>>        {
>>>                loginVo =new LoginVo();
>>>        }
>>
>> @PageLoaded is triggered just once, when the page is instantiated. As
>> Howard
>> said, since 5.2, Tapestry has just one instance of each page and its
>> state
>> is stored in a per-request Map instead of the fields themselves. Just use
>> onActivate() or @SetupRender instead and your problem will go away.
>>
>> --
>> 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-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator of Apache Tapestry
> 
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
> 
> (971) 678-5210
> http://howardlewisship.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

Howard Lewis Ship wrote:
> 
> To reiterate: your code was broken in 5.1, just not as obviously as in
> 5.2.
> 
> On Wed, Mar 2, 2011 at 3:06 AM, Thiago H. de Paula Figueiredo
>  wrote:
>> On Tue, 01 Mar 2011 23:30:42 -0300, Dany  wrote:
>>
>>> Hi,
>>
>> Hi!
>>
>>>        @Property
>>>        Private LoginVo loginVo;
>>>
>>>        @Log
>>>        @PageLoaded
>>>        void pageLoaded()
>>>        {
>>>                loginVo =new LoginVo();
>>>        }
>>
>> @PageLoaded is triggered just once, when the page is instantiated. As
>> Howard
>> said, since 5.2, Tapestry has just one instance of each page and its
>> state
>> is stored in a per-request Map instead of the fields themselves. Just use
>> onActivate() or @SetupRender instead and your problem will go away.
>>
>> --
>> 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-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator of Apache Tapestry
> 
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
> 
> (971) 678-5210
> http://howardlewisship.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-Request-data-shared-in-different-client-browser-tp3405994p3409129.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Mime
View raw message