You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by ksrijith <ks...@gmail.com> on 2012/04/02 18:25:46 UTC

Issue with Component Parameter

Hi,
I'm using using Tapestry version 5.3.
I've created a collage component with is used to show a list of images. I'm
passing the image list as a parameter to the component and inside the
component I'm traversing through the list. I show 10 images at a time and if
there are more than 10 images then allow the user to click a next button and
refresh the zone with the images to show the next 10 images.

The issue I'm facing is happening when I open two different windows each
showing the collage with different list of images. The issue is that for
some reason the list of images for the first window gets updated with the
list in the second window. I believe the Parameter for the component is
keeping a static reference to the list and it gets updated globally for the
session everytime the component is called. 

Is my understanding correct? If so is there a way I could solve this issue,
if anyone has faced the same please do advice.

*Java: This is the model holding the list of images and some other
properties.*


Thanks and Regards,
Srijith

-----
--
Don't Forget to Rate
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Issue-with-Component-Parameter-tp5612950p5612950.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


Re: Issue with Component Parameter

Posted by ksrijith <ks...@gmail.com>.
Thanks I was able to fix the issue by rewriting the code and removing all the
static references. No easy way around :)

-----
--
Don't Forget to Rate
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Issue-with-Component-Parameter-tp5612950p5616931.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


Re: Issue with Component Parameter

Posted by Robert Zeigler <ro...@roxanemy.com>.
Presumably the collage model is initialized/loaded based on some constraint/other information. Either supply that information via onPassivate and then re-initialize in onActivate, or else provide that information to your action handlers so they can retrieve the information as required.

Robert

On Apr 2, 2012, at 4/24:12 PM , ksrijith wrote:

> You were right. I was using a persisted object for the CollageModel in the
> Page and passing the same to the Component. I understand that this is the
> reason that the object gets shared between windows/tabs.
> 
> Though if I don't store the object as a persistent value when I try to
> access it again using an action event (eg: Going to the next page in the
> collage) the CollageModel is no longer available as its not been persisted.
> I know its kind of contradictory to have a non persistent object that can be
> which won't be common across the session but if you could give me some idea
> on how something like that could be implemented it would really help me out. 
> 
> -----
> --
> Don't Forget to Rate
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Issue-with-Component-Parameter-tp5612950p5613703.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
> 


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


Re: Issue with Component Parameter

Posted by ksrijith <ks...@gmail.com>.
You were right. I was using a persisted object for the CollageModel in the
Page and passing the same to the Component. I understand that this is the
reason that the object gets shared between windows/tabs.

Though if I don't store the object as a persistent value when I try to
access it again using an action event (eg: Going to the next page in the
collage) the CollageModel is no longer available as its not been persisted.
I know its kind of contradictory to have a non persistent object that can be
which won't be common across the session but if you could give me some idea
on how something like that could be implemented it would really help me out. 

-----
--
Don't Forget to Rate
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Issue-with-Component-Parameter-tp5612950p5613703.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


Re: Issue with Component Parameter

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 02 Apr 2012 15:31:30 -0300, derkoe  
<ta...@gmail.com> wrote:

> Robert asked if you have a @Persist on your CollageModel in the parent
> component or page. Parameters in Tapestry have a bi-directional binding.  
> So, if you have a @Persist on the model it is shared in the session. Two  
> browser tabs/windows also share the same session.

This is correct when both tabs/windows are viewing the same page.  
@Persist'ed fields are not shared between different pages. @SessionState  
fields do. ;)

-- 
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


Re: Issue with Component Parameter

Posted by derkoe <ta...@gmail.com>.
Robert asked if you have a @Persist on your CollageModel in the parent
component or page. Parameters in Tapestry have a bi-directional binding. So,
if you have a @Persist on the model it is shared in the session. Two browser
tabs/windows also share the same session.
If you want to have state per window you have to either store that on the
client side or implement a sub-session per window. 

We're currently working on a @Persist("window") and @WindowState here
https://github.com/porscheinformatik/tapestry-conversation - but it's just a
work in progress. 

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Issue-with-Component-Parameter-tp5612950p5613282.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


Re: Issue with Component Parameter

Posted by Robert Zeigler <ro...@roxanemy.com>.
@Persist isn't part of @Parameter. They are mutually exclusive. But in your parent component (eg: the page where you're using Collage), is the list @Persist'ed? 

The reference to the collage list shouldn't be static; this is not a problem with Tapestry.  I use components that take list parameters all the time and can open multiple pages (with different) at teh same time with no bleed-over.  It sounds like a problem with your code. Posting a bit more of it would be useful.

Robert

On Apr 2, 2012, at 4/21:08 PM , ksrijith wrote:

> I believe @Persist is part of the @Parameter annotation since if I Persist
> the property then it gives me the following error:
> 
> Field model of class com.karamarie.web.store.components.Collage can not be
> claimed by @org.apache.tapestry5.annotations.Persist as it is already
> claimed by @org.apache.tapestry5.annotations.Parameter.
> 
> where model is the parameter name.
> 
> 
> 
> -----
> --
> Don't Forget to Rate
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Issue-with-Component-Parameter-tp5612950p5613227.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
> 


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


Re: Issue with Component Parameter

Posted by ksrijith <ks...@gmail.com>.
I believe @Persist is part of the @Parameter annotation since if I Persist
the property then it gives me the following error:

Field model of class com.karamarie.web.store.components.Collage can not be
claimed by @org.apache.tapestry5.annotations.Persist as it is already
claimed by @org.apache.tapestry5.annotations.Parameter.

where model is the parameter name.



-----
--
Don't Forget to Rate
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Issue-with-Component-Parameter-tp5612950p5613227.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


Re: Issue with Component Parameter

Posted by Robert Zeigler <ro...@roxanemy.com>.
Are you @Persist'ing the list, eg, in the parent component?

Robert

On Apr 2, 2012, at 4/211:25 AM , ksrijith wrote:

> Hi,
> I'm using using Tapestry version 5.3.
> I've created a collage component with is used to show a list of images. I'm
> passing the image list as a parameter to the component and inside the
> component I'm traversing through the list. I show 10 images at a time and if
> there are more than 10 images then allow the user to click a next button and
> refresh the zone with the images to show the next 10 images.
> 
> The issue I'm facing is happening when I open two different windows each
> showing the collage with different list of images. The issue is that for
> some reason the list of images for the first window gets updated with the
> list in the second window. I believe the Parameter for the component is
> keeping a static reference to the list and it gets updated globally for the
> session everytime the component is called. 
> 
> Is my understanding correct? If so is there a way I could solve this issue,
> if anyone has faced the same please do advice.
> 
> *Java: This is the model holding the list of images and some other
> properties.*
> 
> 
> Thanks and Regards,
> Srijith
> 
> -----
> --
> Don't Forget to Rate
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Issue-with-Component-Parameter-tp5612950p5612950.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
> 


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