You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Teodor Danciu <te...@rdslink.ro> on 2003/11/05 10:12:46 UTC

Stale link problem using ActionLink inside table

Hello,

I have a table with the first column containing checkboxes
to remove the selected lines.
This is why I have placed this table inside a form.

Also, for the first text column I have a special renderer
that uses an ActionLink component to edit the current row.
Inside the listener for this action link I try to get
the current row and set some persistent property on the page,
to know what was the row that the user chose to edit.

Initially, I was using a DirectLink component, but I was
forced to give up using it since there is no ID for my rows
to encode in the URL and I really need to get hold of the exact
row instance object.

The problem with ActionLink is that on one page it works fine,
but on another it gives me "Stale Link exception".
I read about the fact that when using ActionLink you have
to make sure that the rewind process produces the exact same
output as the previous render, but I just can't figure
out what happens. I do not affect my rows inside the listener.

I have worked with the debugger on Tapestry 3.0 beta 3 and saw
that it reaches line 553 inside RequestCycle.java.
There is a comment there that says

//Shouldn't get this far, because the target component should
// throw the RenderRewoundException.

I also tried using ListEdit instead of ForEach or TableFormRows
instead of TableRows to iterate, but it looks like the action link
gives me stale link exception even on the first page where it previously
work fine.

My question is: can I get hold of the current row instance using
an ActionLink as a cell rendered in the table or is the DirectLink
(encoding ID in the URL) the only solution .

Thank you,
Teodor





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


Re: Stale link problem using ActionLink inside table

Posted by Teodor Danciu <te...@rdslink.ro>.
Hi,

Finally, I found a solution for this problem.
It boils down to postponing the execution of a LinkSubmit
until the execution of the form submit.
I read about a future fixture of this using a parameter,
but until then I made some custom components for Form
and LinkSubmit.

Tapestry is pretty cool after you get to taste it.

Thank you,
Teodor


Teodor Danciu wrote:

>
> Hi,
>
> The DirectLink solution is not appropriate in my case since I do not have
> and ID to encode. And putting the whole object in the URL does not 
> help either
> because inside the listener, after retrieving this object as a service 
> parameter,
> there is no way for me to find the original row inside the table model 
> that
> served as the current row when the link was called (the only solution 
> I see
> is using the hashCode as ID but is a dirty solution).
>
> After making some further research, it looks like my problem comes
> from the fact that the tabel is placed inside a FormConditional.
> I use FormConditional because my page is a sort of an editor with
> multiple tabs. I made a custom version of the TabPanel component
> from the docs, but it needs to perform a submit when the user changes
> the current tab. It works, except that the ActionLinks inside the tables
> do not seem to work anymore due to "Stale Link".
>
> I know this is a complex case, but maybe someone else could give
> me a hint. I'm out of ideas...
>
> Thank you,
> Teodor
>
>
>
> Glen Stampoultzis wrote:
>
>>
>> Warning:  I'm a newbie so I probably don't know what I'm talking 
>> about but...
>>
>> I was getting the same problem with ActionLink.  It's behavior seems 
>> broken and inconsistent.  I swapped to using DirectLink.  It seems 
>> that with direct link you can encode objects, not just id's.  I'm not 
>> sure if this is a wise thing to be doing but it appears to work for me.
>>
>> Regards,
>>
>> Glen
>>
>> At 08:12 PM 5/11/2003, you wrote:
>>
>>> Hello,
>>>
>>> I have a table with the first column containing checkboxes
>>> to remove the selected lines.
>>> This is why I have placed this table inside a form.
>>>
>>> Also, for the first text column I have a special renderer
>>> that uses an ActionLink component to edit the current row.
>>> Inside the listener for this action link I try to get
>>> the current row and set some persistent property on the page,
>>> to know what was the row that the user chose to edit.
>>>
>>> Initially, I was using a DirectLink component, but I was
>>> forced to give up using it since there is no ID for my rows
>>> to encode in the URL and I really need to get hold of the exact
>>> row instance object.
>>>
>>> The problem with ActionLink is that on one page it works fine,
>>> but on another it gives me "Stale Link exception".
>>> I read about the fact that when using ActionLink you have
>>> to make sure that the rewind process produces the exact same
>>> output as the previous render, but I just can't figure
>>> out what happens. I do not affect my rows inside the listener.
>>>
>>> I have worked with the debugger on Tapestry 3.0 beta 3 and saw
>>> that it reaches line 553 inside RequestCycle.java.
>>> There is a comment there that says
>>>
>>> //Shouldn't get this far, because the target component should
>>> // throw the RenderRewoundException.
>>>
>>> I also tried using ListEdit instead of ForEach or TableFormRows
>>> instead of TableRows to iterate, but it looks like the action link
>>> gives me stale link exception even on the first page where it 
>>> previously
>>> work fine.
>>>
>>> My question is: can I get hold of the current row instance using
>>> an ActionLink as a cell rendered in the table or is the DirectLink
>>> (encoding ID in the URL) the only solution .
>>>
>>> Thank you,
>>> Teodor
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>
>>
>> Glen Stampoultzis
>> gstamp@iinet.net.au
>> http://members.iinet.net.au/~gstamp/glen/
>>
>
>
>
> ---------------------------------------------------------------------
> 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: Stale link problem using ActionLink inside table

Posted by Teodor Danciu <te...@rdslink.ro>.
Hi,

The DirectLink solution is not appropriate in my case since I do not have
and ID to encode. And putting the whole object in the URL does not help 
either
because inside the listener, after retrieving this object as a service 
parameter,
there is no way for me to find the original row inside the table model that
served as the current row when the link was called (the only solution I see
is using the hashCode as ID but is a dirty solution).

After making some further research, it looks like my problem comes
from the fact that the tabel is placed inside a FormConditional.
I use FormConditional because my page is a sort of an editor with
multiple tabs. I made a custom version of the TabPanel component
from the docs, but it needs to perform a submit when the user changes
the current tab. It works, except that the ActionLinks inside the tables
do not seem to work anymore due to "Stale Link".

I know this is a complex case, but maybe someone else could give
me a hint. I'm out of ideas...

Thank you,
Teodor



Glen Stampoultzis wrote:

>
> Warning:  I'm a newbie so I probably don't know what I'm talking about 
> but...
>
> I was getting the same problem with ActionLink.  It's behavior seems 
> broken and inconsistent.  I swapped to using DirectLink.  It seems 
> that with direct link you can encode objects, not just id's.  I'm not 
> sure if this is a wise thing to be doing but it appears to work for me.
>
> Regards,
>
> Glen
>
> At 08:12 PM 5/11/2003, you wrote:
>
>> Hello,
>>
>> I have a table with the first column containing checkboxes
>> to remove the selected lines.
>> This is why I have placed this table inside a form.
>>
>> Also, for the first text column I have a special renderer
>> that uses an ActionLink component to edit the current row.
>> Inside the listener for this action link I try to get
>> the current row and set some persistent property on the page,
>> to know what was the row that the user chose to edit.
>>
>> Initially, I was using a DirectLink component, but I was
>> forced to give up using it since there is no ID for my rows
>> to encode in the URL and I really need to get hold of the exact
>> row instance object.
>>
>> The problem with ActionLink is that on one page it works fine,
>> but on another it gives me "Stale Link exception".
>> I read about the fact that when using ActionLink you have
>> to make sure that the rewind process produces the exact same
>> output as the previous render, but I just can't figure
>> out what happens. I do not affect my rows inside the listener.
>>
>> I have worked with the debugger on Tapestry 3.0 beta 3 and saw
>> that it reaches line 553 inside RequestCycle.java.
>> There is a comment there that says
>>
>> //Shouldn't get this far, because the target component should
>> // throw the RenderRewoundException.
>>
>> I also tried using ListEdit instead of ForEach or TableFormRows
>> instead of TableRows to iterate, but it looks like the action link
>> gives me stale link exception even on the first page where it previously
>> work fine.
>>
>> My question is: can I get hold of the current row instance using
>> an ActionLink as a cell rendered in the table or is the DirectLink
>> (encoding ID in the URL) the only solution .
>>
>> Thank you,
>> Teodor
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
>
> Glen Stampoultzis
> gstamp@iinet.net.au
> http://members.iinet.net.au/~gstamp/glen/
>



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


Re: Stale link problem using ActionLink inside table

Posted by Glen Stampoultzis <gs...@iinet.net.au>.
Warning:  I'm a newbie so I probably don't know what I'm talking about but...

I was getting the same problem with ActionLink.  It's behavior seems broken 
and inconsistent.  I swapped to using DirectLink.  It seems that with 
direct link you can encode objects, not just id's.  I'm not sure if this is 
a wise thing to be doing but it appears to work for me.

Regards,

Glen

At 08:12 PM 5/11/2003, you wrote:

>Hello,
>
>I have a table with the first column containing checkboxes
>to remove the selected lines.
>This is why I have placed this table inside a form.
>
>Also, for the first text column I have a special renderer
>that uses an ActionLink component to edit the current row.
>Inside the listener for this action link I try to get
>the current row and set some persistent property on the page,
>to know what was the row that the user chose to edit.
>
>Initially, I was using a DirectLink component, but I was
>forced to give up using it since there is no ID for my rows
>to encode in the URL and I really need to get hold of the exact
>row instance object.
>
>The problem with ActionLink is that on one page it works fine,
>but on another it gives me "Stale Link exception".
>I read about the fact that when using ActionLink you have
>to make sure that the rewind process produces the exact same
>output as the previous render, but I just can't figure
>out what happens. I do not affect my rows inside the listener.
>
>I have worked with the debugger on Tapestry 3.0 beta 3 and saw
>that it reaches line 553 inside RequestCycle.java.
>There is a comment there that says
>
>//Shouldn't get this far, because the target component should
>// throw the RenderRewoundException.
>
>I also tried using ListEdit instead of ForEach or TableFormRows
>instead of TableRows to iterate, but it looks like the action link
>gives me stale link exception even on the first page where it previously
>work fine.
>
>My question is: can I get hold of the current row instance using
>an ActionLink as a cell rendered in the table or is the DirectLink
>(encoding ID in the URL) the only solution .
>
>Thank you,
>Teodor
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


Glen Stampoultzis
gstamp@iinet.net.au
http://members.iinet.net.au/~gstamp/glen/