Re: Help needed with DirectLink and page parameters (Was: Contrib:Table and page parameters)

2007-12-21 Thread Kaspar Fischer


On 20.12.2007, at 18:16, [EMAIL PROTECTED]  
[EMAIL PROTECTED] wrote:

Does this mean that Tapestry will keep in its page pool an
IExternalPage page for each article I have in the DB (once
this page is visited)?


Please refer to
 http://tapestry.apache.org/tapestry4.1/usersguide/state.html
Tapestry will keep in its pool one instance for each *concurrent
request* it is serving. Your persistent page-id will be stored in the
session or on the client (configurable).
When a request comes in, Tapestry will pick a page from the pool and
provide it with the persistent property data, e.g. the reference to  
your

db-data.


I don't see how this solves my problem of emitting DirectLinks with
parameters into the page. If I understand you correctly, you say that
by using persisted properties, my DirectLinks do not need to contain
the page's parameters, right?

Suppose my article page contains a link to download the article. This
link is implemented via a DirectLink. Suppose now the user opens two  
tabs,

in this order:

  http://my.org/app?page=Articleid=1
  http://my.org/app?page=Articleid=2

After this, the session holds id=2. Now the user clicks the download
link in the former page (id=1). As this DirectLink does not contain  
id=1

the user will get article 2. That's not what the user expects.

Do I misunderstand this?

It seems to me that persistent properties do not solve the problem. I
need a way to tell DirectLink to look up the current external page's
parameter's and embed them in the link.

Kaspar

P.S. I understand that I can pass additional parameters to the  
DirectLink

by setting its parameters parameter. Still, I am posting because
I do not understand Tapestry's idea of handling page parameters:  For
instance, I want to use Contrib:Table on my page. It emits lots of links
(links to sort the table). But if these links do not contain my page
parameters, the page will not render when the user clicks to sort the
table. That's why I ask how to do this with a simple DirectLink --  
although

my actual problem is Contrib:Table, and possibly other components.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Help needed with DirectLink and page parameters (Was: Contrib:Table and page parameters)

2007-12-21 Thread Marcus Schulte
2007/12/21, Kaspar Fischer [EMAIL PROTECTED]:


 On 20.12.2007, at 18:16, [EMAIL PROTECTED]
 [EMAIL PROTECTED] wrote:
  Does this mean that Tapestry will keep in its page pool an
  IExternalPage page for each article I have in the DB (once
  this page is visited)?
 
  Please refer to
   http://tapestry.apache.org/tapestry4.1/usersguide/state.html
  Tapestry will keep in its pool one instance for each *concurrent
  request* it is serving. Your persistent page-id will be stored in the
  session or on the client (configurable).
  When a request comes in, Tapestry will pick a page from the pool and
  provide it with the persistent property data, e.g. the reference to
  your
  db-data.

 I don't see how this solves my problem of emitting DirectLinks with
 parameters into the page. If I understand you correctly, you say that
 by using persisted properties, my DirectLinks do not need to contain
 the page's parameters, right?

 Suppose my article page contains a link to download the article. This
 link is implemented via a DirectLink. Suppose now the user opens two
 tabs,
 in this order:

http://my.org/app?page=Articleid=1
http://my.org/app?page=Articleid=2

 After this, the session holds id=2. Now the user clicks the download
 link in the former page (id=1). As this DirectLink does not contain
 id=1
 the user will get article 2. That's not what the user expects.

 Do I misunderstand this?

 It seems to me that persistent properties do not solve the problem. I
 need a way to tell DirectLink to look up the current external page's
 parameter's and embed them in the link.


Sounds like what you really want is client-side persistence. This will store
your page-state in the URL - or in a hidden field, if your page uses forms.
So, to be concrete, if you're having a non-null property annotated with
@Persist(client), or tagged appropriately in the .page xml-File, your
direct Link will, magically, render as something like:

http://localhost:8080/myapp/app?component=dlpage=Homeservice=directstate:Home=BrO0ABXcQAQAACXRyaWdnZXJlZHQAATE%3D

The funny String making up the value of the parameter state:Home is
actually the Base64 encoded version of your page-state. That way, a user
opnening several instances of your page in multiple browser windows/tabs
will see what he expects (possibly ;))

Btw., don't worry about asking basic questions, that's ok, of course.


Marcus

-- 
Marcus Schulte
http://marcus-schulte.blogspot.com


RE: Help needed with DirectLink and page parameters (Was: Contrib:Table and page parameters)

2007-12-20 Thread Marcus.Schulte
I suppose your page implements IExternalPage?
If you seed you page/app with external parameters which you need later
on,
in subsequent requests, store them in page/component properties marked
as
@Persist-ent.

 -Original Message-
 From: Kaspar Fischer [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, December 19, 2007 4:10 PM
 To: Tapestry users
 Subject: Help needed with DirectLink and page parameters 
 (Was: Contrib:Table and page parameters)
 
 Dear list,
 
 In order to isolate the problem, I tried to do something much
 simpler: showing
 a DirectLink on one of my pages.
 
 The tapestry manual gives an example on how to use DirectLink with
 listeners:
 
http://tapestry.apache.org/tapestry4/QuickStart/directlink.html

 http://tapestry.apache.org/tapestry4/UsersGuide/listenermethods.html
 
 However, these examples assume that the content of the page 
 containing the DirectLink does not depend on page parameters.
 
 How can I use a DirectLink on a page that depends on a 
 parameter, for instance of, on a page like this
 
http://my.org/app?page=Articleid=27
 
 The link generated by a DirectLink component is something like
 
http://...Article,$MyComponent.$DirectLink.sdirect
 
 but does not mention the id. So the listener is executed but 
 afterwards, the Article page does not know which item (namely 
 id=27) it should show!
 
 I feel very much that I am on the wrong track and would be 
 very glad to receive some help.
 
 Many thanks,
 Kaspar
 
 On 17.12.2007, at 20:50, Kaspar Fischer wrote:
  Hm, I think my question was not well formulated. Apologies. 
 I'll try 
  once more!
 
  Suppose you want to implement an index that shows all files 
 starting 
  with A, B, etc. My page would show
 
A B C D ... X Y Z
 
  and you can click on a letter to show the files starting with this 
  letter in a sortable Contrib:Table. How would I do this?
 
  Can somebody lead me on the right track?
 
  Thanks!
  Kaspar
 
  On 16.12.2007, at 17:08, Kaspar Fischer wrote:
 
  Hi list,
 
  How can I tell Contrib:Table to pass on page paremeters? 
 When I click 
  on a table column to sort it, the page that opens does not 
 have the 
  page parameters of the old page anymore!
 
  More precisely, my page Page.html uses a paremeter 
 (nodeid) to know 
  what content to display. So in Page.java's 
 pageBeginRender() method I 
  have
 
  String nodeIdParam = cycle.getParameter(nodeid);
 
  and then I load the data from a database and display a few 
 things in 
  a Contrib:Table.
 
  Unfortunately, the link that the Contrib:Table generates 
 in order to 
  sort a column does not contain the value for parameter nodeid:
 
http://localhost:8080/kc/
  Page,tableColumnComponent.linkColumn.sdirect?container=Contrib%
  3ASimpleTableColumnPagesp=APage%2C%
  24SortableTable.table.tableViewsp=SnodeTableTitle
 
  So when I click the link, my node does not know what data to load 
  from the database!
 
  I think I need to tell Contrib:Table to include the nodeid in the 
  link, right?
 
  How can I do this?
 
  Many thanks,
  Kaspar
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Help needed with DirectLink and page parameters (Was: Contrib:Table and page parameters)

2007-12-20 Thread Andreas Pursian
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Kasper,


 How can I use a DirectLink on a page that depends on a parameter, for
 instance of, on a page like this

   http://my.org/app?page=Articleid=27

So if i got the point, you just want to create a link that refers to a
special article wich is identified by an id ... right?


 The tapestry manual gives an example on how to use DirectLink with
 listeners:

   http://tapestry.apache.org/tapestry4/QuickStart/directlink.html

if you read a bit further there is a part Passing data in the links
... which should solve your problem.

Andreas


Kaspar Fischer wrote:
 Dear list,
 
 In order to isolate the problem, I tried to do something much simpler:
 showing
 a DirectLink on one of my pages.
 
 The tapestry manual gives an example on how to use DirectLink with
 listeners:
 
   http://tapestry.apache.org/tapestry4/QuickStart/directlink.html
   http://tapestry.apache.org/tapestry4/UsersGuide/listenermethods.html
 
 However, these examples assume that the content of the page containing the
 DirectLink does not depend on page parameters.
 
 How can I use a DirectLink on a page that depends on a parameter, for
 instance of, on a page like this
 
   http://my.org/app?page=Articleid=27
 
 The link generated by a DirectLink component is something like
 
   http://...Article,$MyComponent.$DirectLink.sdirect
 
 but does not mention the id. So the listener is executed but afterwards,
 the Article page does not know which item (namely id=27) it should show!
 
 I feel very much that I am on the wrong track and would be very glad to
 receive some help.
 
 Many thanks,
 Kaspar
 
 On 17.12.2007, at 20:50, Kaspar Fischer wrote:
 Hm, I think my question was not well formulated. Apologies. I'll try
 once more!

 Suppose you want to implement an index that shows all files starting with
 A, B, etc. My page would show

   A B C D ... X Y Z

 and you can click on a letter to show the files starting with this letter
 in a sortable Contrib:Table. How would I do this?

 Can somebody lead me on the right track?

 Thanks!
 Kaspar

 On 16.12.2007, at 17:08, Kaspar Fischer wrote:

 Hi list,

 How can I tell Contrib:Table to pass on page paremeters? When I click on
 a table column to sort it, the page that opens does not have the page
 parameters of the old page anymore!

 More precisely, my page Page.html uses a paremeter (nodeid) to know
 what content to display. So in Page.java's pageBeginRender() method I
 have

 String nodeIdParam = cycle.getParameter(nodeid);

 and then I load the data from a database and display a few things in
 a Contrib:Table.

 Unfortunately, the link that the Contrib:Table generates in order to
 sort a column does not contain the value for parameter nodeid:

  
 http://localhost:8080/kc/Page,tableColumnComponent.linkColumn.sdirect?container=Contrib%3ASimpleTableColumnPagesp=APage%2C%24SortableTable.table.tableViewsp=SnodeTableTitle


 So when I click the link, my node does not know what data to load from
 the database!

 I think I need to tell Contrib:Table to include the nodeid in the link,
 right?

 How can I do this?

 Many thanks,
 Kaspar
 

 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHakWZM14O/Esx/74RAr0NAJ9pFv2K9OTzJ/zBl78ArQ3WinoH5wCgkqyC
7KlJPCE7kiJKuTgiK9N53gs=
=NXgf
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Help needed with DirectLink and page parameters (Was: Contrib:Table and page parameters)

2007-12-20 Thread Kaspar Fischer

Hi Andreas,

On 20.12.2007, at 11:36, Andreas Pursian wrote:


How can I use a DirectLink on a page that depends on a parameter, for
instance of, on a page like this

  http://my.org/app?page=Articleid=27


So if i got the point, you just want to create a link that refers to a
special article wich is identified by an id ... right?


The tapestry manual gives an example on how to use DirectLink with
listeners:

  http://tapestry.apache.org/tapestry4/QuickStart/directlink.html


if you read a bit further there is a part Passing data in the links
... which should solve your problem.


I have read this, and you are right: it solves the problem in this  
particular

case where I only want to generate a link.

However, if you look at my original post, then I do not see anymore how
to solve the problem. The latter post is about generating links, too.  
But this time
it is not me who is generating the links but Contrib:Table. (It  
generates
links to sort a table.) Again, I run into the same problem: The links  
generated
by Contrib:Table only identify the page class (Article) but *not* its  
id.
So when you click on the link, the page does not know which article  
to show.


In the DirectLink example, I can -- as you say -- pass parameters  
manually.

But how would I do it with Contrib:Table?

Kaspar


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Help needed with DirectLink and page parameters (Was: Contrib:Table and page parameters)

2007-12-20 Thread Kaspar Fischer

Dear Marcus,

First of all, thanks a lot for your reply!

I am not sure whether I understand what you say. I have a variable  
(and huge)
number of actual pages. (In fact, each is coming from a DB entry.)  
Because the
number is variable, I chose to implement a *single* Tapestry page  
class for the

*many* pages I have.

On 20.12.2007, at 09:55, [EMAIL PROTECTED]  
[EMAIL PROTECTED] wrote:



I suppose your page implements IExternalPage?


You mean that I create a single Tapestry class implementing  
IExternalPage,

right? All my (variably many) pages use this class. Correct?


If you seed you page/app with external parameters which you need later
on, in subsequent requests, store them in page/component properties  
marked

as @Persist-ent.


Does this mean that Tapestry will keep in its page pool an  
IExternalPage page

for each article I have in the DB (once this page is visited)?

Is this a good idea? I have lots of pages and at some point, the memory
might be full. Or is there some mechanism that purges pages from the  
cache?


I am sorry if my questions are quite basic! The more I appreciate  
your help.


Kaspar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Help needed with DirectLink and page parameters (Was: Contrib:Table and page parameters)

2007-12-20 Thread Marcus.Schulte

  I suppose your page implements IExternalPage?
 
 You mean that I create a single Tapestry class implementing 
 IExternalPage, right? All my (variably many) pages use this 
 class. Correct?

Yes.

 
  If you seed you page/app with external parameters which you 
 need later 
  on, in subsequent requests, store them in page/component properties 
  marked as @Persist-ent.
 
 Does this mean that Tapestry will keep in its page pool an 
 IExternalPage page for each article I have in the DB (once 
 this page is visited)?

Please refer to
 http://tapestry.apache.org/tapestry4.1/usersguide/state.html
Tapestry will keep in its pool one instance for each *concurrent
request* it is serving. Your persistent page-id will be stored in the
session or on the client (configurable).
When a request comes in, Tapestry will pick a page from the pool and
provide it with the persistent property data, e.g. the reference to your
db-data.

 
 Is this a good idea? I have lots of pages and at some point, 
 the memory might be full. Or is there some mechanism that 
 purges pages from the cache?
 
 I am sorry if my questions are quite basic! The more I 
 appreciate your help.
 
 Kaspar
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Help needed with DirectLink and page parameters (Was: Contrib:Table and page parameters)

2007-12-19 Thread Kaspar Fischer

Dear list,

In order to isolate the problem, I tried to do something much  
simpler: showing

a DirectLink on one of my pages.

The tapestry manual gives an example on how to use DirectLink with  
listeners:


  http://tapestry.apache.org/tapestry4/QuickStart/directlink.html
  http://tapestry.apache.org/tapestry4/UsersGuide/listenermethods.html

However, these examples assume that the content of the page  
containing the

DirectLink does not depend on page parameters.

How can I use a DirectLink on a page that depends on a parameter, for
instance of, on a page like this

  http://my.org/app?page=Articleid=27

The link generated by a DirectLink component is something like

  http://...Article,$MyComponent.$DirectLink.sdirect

but does not mention the id. So the listener is executed but afterwards,
the Article page does not know which item (namely id=27) it should show!

I feel very much that I am on the wrong track and would be very glad to
receive some help.

Many thanks,
Kaspar

On 17.12.2007, at 20:50, Kaspar Fischer wrote:

Hm, I think my question was not well formulated. Apologies. I'll try
once more!

Suppose you want to implement an index that shows all files  
starting with

A, B, etc. My page would show

  A B C D ... X Y Z

and you can click on a letter to show the files starting with this  
letter

in a sortable Contrib:Table. How would I do this?

Can somebody lead me on the right track?

Thanks!
Kaspar

On 16.12.2007, at 17:08, Kaspar Fischer wrote:


Hi list,

How can I tell Contrib:Table to pass on page paremeters? When I  
click on

a table column to sort it, the page that opens does not have the page
parameters of the old page anymore!

More precisely, my page Page.html uses a paremeter (nodeid) to know
what content to display. So in Page.java's pageBeginRender() method I
have

String nodeIdParam = cycle.getParameter(nodeid);

and then I load the data from a database and display a few things in
a Contrib:Table.

Unfortunately, the link that the Contrib:Table generates in order to
sort a column does not contain the value for parameter nodeid:

  http://localhost:8080/kc/ 
Page,tableColumnComponent.linkColumn.sdirect?container=Contrib% 
3ASimpleTableColumnPagesp=APage%2C% 
24SortableTable.table.tableViewsp=SnodeTableTitle


So when I click the link, my node does not know what data to load  
from

the database!

I think I need to tell Contrib:Table to include the nodeid in the  
link,

right?

How can I do this?

Many thanks,
Kaspar






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]