You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Rodrigo Barberá <rb...@tecgraf.puc-rio.br> on 2006/06/26 16:26:38 UTC

New Window issue

Hello!

There is this little problem, if I can even call it a problem, I'd like 
help to find a solution to.  My Tapestry 4.0 application basically 
consists of two pages.  One contains a form in which the user can enter 
search parameters.  This page executes the query and passes the object 
ids on to the results page.  The results page contains only a table 
which renders itself dynamically (that is, columns are added as needed 
depending on what kind of object is obtained from the ids) and can be 
paginated.  Those ids are stored in a property and it was set to 
persist="client".  However, we found out that it wouldn't work with 
larger result sets.  So we set it to persist="session".  This created a 
small issue, which is:  if the user opens a new window (hitting CTRL-N, 
for example) and performs a new search, and then returns to the previous 
window and paginates, he finds himself navigating the results of the new 
search.  That is, we lost the capability of 'forking' (sorry, couldn't 
find a different way to express myself) we used to have with 
persist="client".  Has anyone got any idea for solving this issue?

Thank you!

Greetings
Rodrigo

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


Re: New Window issue

Posted by Richard Kirby <rb...@capdm.com>.
Hi Rodrigo again,

Umm, actually you should just need to generate a new key each time the 
search form is submitted for a new search.

Cheers

Richard

Richard Kirby wrote:
> Hi Rodrigo,
>
> What you will need to do is ensure that caching is disabled for the 
> pages that use this key idea. Then CTRL-N or File | New Window should 
> cause the browser to refresh from the server - they will request the 
> same url as the original page, so that allows you to detect that a new 
> key is needed. Search the mailing list/wiki for tips on turning off 
> browser caching (basically a delegate to your Shell component that 
> sends the appropriate headers to tell the browsers not to cache the 
> page).
>
> For you example, the search page should basically always generate a 
> new key, whilst the results page will just pass back the key. This 
> should then mean that everytime a browser goes to the search page, 
> because it is not cached it will poke the server which will then 
> return a new search page with a new key, and you should then be sorted!
>
> Cheers
>
> Richard
>
> Rodrigo Barberá wrote:
>> Hi Richard!
>>
>> Thank you for your reply.  It sounds like a very good solution to my 
>> problem.
>>
>> However, I can't find out a way to generate a new key when the user 
>> hits CTRL-N or clicks 'File | New Window' and a new window is open.  
>> Any ideas?
>>
>> Thanks a lot in advance!
>>
>> Rodrigo
>>
>
>
> ---------------------------------------------------------------------
> 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: New Window issue

Posted by Richard Kirby <rb...@capdm.com>.
Hi Rodrigo,

What you will need to do is ensure that caching is disabled for the 
pages that use this key idea. Then CTRL-N or File | New Window should 
cause the browser to refresh from the server - they will request the 
same url as the original page, so that allows you to detect that a new 
key is needed. Search the mailing list/wiki for tips on turning off 
browser caching (basically a delegate to your Shell component that sends 
the appropriate headers to tell the browsers not to cache the page).

For you example, the search page should basically always generate a new 
key, whilst the results page will just pass back the key. This should 
then mean that everytime a browser goes to the search page, because it 
is not cached it will poke the server which will then return a new 
search page with a new key, and you should then be sorted!

Cheers

Richard

Rodrigo Barberá wrote:
> Hi Richard!
>
> Thank you for your reply.  It sounds like a very good solution to my 
> problem.
>
> However, I can't find out a way to generate a new key when the user 
> hits CTRL-N or clicks 'File | New Window' and a new window is open.  
> Any ideas?
>
> Thanks a lot in advance!
>
> Rodrigo
>


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


Re: New Window issue

Posted by Rodrigo Barberá <rb...@tecgraf.puc-rio.br>.
Hi Richard!

Thank you for your reply.  It sounds like a very good solution to my 
problem.

However, I can't find out a way to generate a new key when the user hits 
CTRL-N or clicks 'File | New Window' and a new window is open.  Any ideas?

Thanks a lot in advance!

Rodrigo



Richard Kirby wrote:
> Hi Rodnei and Rodrigo,
>
> Browsers have an upper limit on url lengths, so as you have found, 
> using the client persistence strategy can easily hit this limit. One 
> possible solution is instead to store your state in a database or even 
> a Map at the server, and use a random number as a key to this state. 
> This key can be safely client persisted as it will not be too long. If 
> you use a WeakHashMap or some kind of expiry strategy with the 
> database, then you don't have to concern yourself too greatly with 
> filling up with stale data.
>
> Hope that gives you a pointer
>
> Richard
>
> rodneisc-des@yahoo.com.br wrote:
>> Hi...
>>      I have a similiar problem, and i haven't solved it yet... my 
>> question is how to have client properties that have more than 4000 
>> characters... or anything equivalent...      Can anyone help me, please?
>>      []'s
>> Rodnei Couto
>>
>> Rodrigo Barberá <rb...@tecgraf.puc-rio.br> escreveu:
>>   Hello!
>>
>> There is this little problem, if I can even call it a problem, I'd 
>> like help to find a solution to. My Tapestry 4.0 application 
>> basically consists of two pages. One contains a form in which the 
>> user can enter search parameters. This page executes the query and 
>> passes the object ids on to the results page. The results page 
>> contains only a table which renders itself dynamically (that is, 
>> columns are added as needed depending on what kind of object is 
>> obtained from the ids) and can be paginated. Those ids are stored in 
>> a property and it was set to persist="client". However, we found out 
>> that it wouldn't work with larger result sets. So we set it to 
>> persist="session". This created a small issue, which is: if the user 
>> opens a new window (hitting CTRL-N, for example) and performs a new 
>> search, and then returns to the previous window and paginates, he 
>> finds himself navigating the results of the new search. That is, we 
>> lost the capability of 'forking' (sorry, couldn't find a different 
>> way to express myself) we used to have with persist="client". Has 
>> anyone got any idea for solving this issue?
>>
>> Thank you!
>>
>> Greetings
>> Rodrigo
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>>         
>> ---------------------------------
>>  Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu 
>> celular. Registre seu aparelho agora!
>>   
>
>
> ---------------------------------------------------------------------
> 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: New Window issue

Posted by Richard Kirby <rb...@capdm.com>.
Hi Rodnei and Rodrigo,

Browsers have an upper limit on url lengths, so as you have found, using 
the client persistence strategy can easily hit this limit. One possible 
solution is instead to store your state in a database or even a Map at 
the server, and use a random number as a key to this state. This key can 
be safely client persisted as it will not be too long. If you use a 
WeakHashMap or some kind of expiry strategy with the database, then you 
don't have to concern yourself too greatly with filling up with stale data.

Hope that gives you a pointer

Richard

rodneisc-des@yahoo.com.br wrote:
> Hi...
>    
>   I have a similiar problem, and i haven't solved it yet... my question is how to 
> have client properties that have more than 4000 characters... or anything equivalent... 
>    
>   Can anyone help me, please?
>    
>   []'s
> Rodnei Couto
>
> Rodrigo Barberá <rb...@tecgraf.puc-rio.br> escreveu:
>   Hello!
>
> There is this little problem, if I can even call it a problem, I'd like 
> help to find a solution to. My Tapestry 4.0 application basically 
> consists of two pages. One contains a form in which the user can enter 
> search parameters. This page executes the query and passes the object 
> ids on to the results page. The results page contains only a table 
> which renders itself dynamically (that is, columns are added as needed 
> depending on what kind of object is obtained from the ids) and can be 
> paginated. Those ids are stored in a property and it was set to 
> persist="client". However, we found out that it wouldn't work with 
> larger result sets. So we set it to persist="session". This created a 
> small issue, which is: if the user opens a new window (hitting CTRL-N, 
> for example) and performs a new search, and then returns to the previous 
> window and paginates, he finds himself navigating the results of the new 
> search. That is, we lost the capability of 'forking' (sorry, couldn't 
> find a different way to express myself) we used to have with 
> persist="client". Has anyone got any idea for solving this issue?
>
> Thank you!
>
> Greetings
> Rodrigo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
>  		
> ---------------------------------
>  Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora!
>   


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


Re: New Window issue

Posted by ro...@yahoo.com.br.
Hi...
   
  I have a similiar problem, and i haven't solved it yet... my question is how to 
have client properties that have more than 4000 characters... or anything equivalent... 
   
  Can anyone help me, please?
   
  []'s
Rodnei Couto

Rodrigo Barberá <rb...@tecgraf.puc-rio.br> escreveu:
  Hello!

There is this little problem, if I can even call it a problem, I'd like 
help to find a solution to. My Tapestry 4.0 application basically 
consists of two pages. One contains a form in which the user can enter 
search parameters. This page executes the query and passes the object 
ids on to the results page. The results page contains only a table 
which renders itself dynamically (that is, columns are added as needed 
depending on what kind of object is obtained from the ids) and can be 
paginated. Those ids are stored in a property and it was set to 
persist="client". However, we found out that it wouldn't work with 
larger result sets. So we set it to persist="session". This created a 
small issue, which is: if the user opens a new window (hitting CTRL-N, 
for example) and performs a new search, and then returns to the previous 
window and paginates, he finds himself navigating the results of the new 
search. That is, we lost the capability of 'forking' (sorry, couldn't 
find a different way to express myself) we used to have with 
persist="client". Has anyone got any idea for solving this issue?

Thank you!

Greetings
Rodrigo

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



 		
---------------------------------
 Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora!