You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andrea Chiumenti <ki...@gmail.com> on 2007/01/27 14:57:10 UTC

Stale link exception

Hello,
I'm using Tapestry 4.1.1 and I'm trying to update a comopnent.
This component is a grid, that in normal state hasn't any input component.
The first time i call addNew, that adds a new row with input elements all
goes well.
The next time i call this function I have a StaleLinkException.

with this message:
Rewind of form Home/thisForm expected allocated id #9 to be 'nameField', but
was 'addNew' (requested by component Home/tableForm.addNew).

The call is an ajax call that updates the table containing the row.

How can I prevent the stale link exception, how does Tapestry 4.1.1 threats
stale links ?

Thanks in advance,
kiuma

Re: Stale link exception

Posted by Andrea Chiumenti <ki...@gmail.com>.
The problem is this:

when send an add new command I have this strange behavior:

the whole form is updated, but I want to update only the grid. How can I do?

A sipplet of the code here :

<form jwcid="thisForm@Form" listener="listener:doSomething"
updateComponents="ognl:{components.thisForm.id}" async='ognl:true'
        clientValidationEnabled="ognl:true">

<span jwcid="addNew"/>

</form>
===========================
<component id="addNew" type="Submit">
        <binding name="value" value="literal:addNew"/>
        <binding name="updateComponents" value="ognl:{id}"/>
        <binding name="listener" value="ognl:addNewAction"/>
        <binding name="async" value="ognl:true"></binding>
    </component>

On 1/27/07, Andrea Chiumenti <ki...@gmail.com> wrote:
>
> Thank you for your reply!
>
> I've understood my mistake: it was that I set volatile to true in two
> places I didn't have to.
>
> Backing to the normal behavior  now I can also provide the component
> without its own form.
> Now I have another question: How can I pervent the validation of
> components outside the grid when I add a row ?
>
> kiuma
>
> On 1/27/07, RonPiterman <rp...@gmx.net> wrote:
> >
> > first, I would not in any cas try to write my own form component.
> >
> > So, stale links:
> >
> > In order for tapestry to submit a form, all form components must be
> > rendered on submit on the same order they were rendered for the response
> > which generated the form.
> >
> > to make sure this happens, tapestry records the order of the components,
> >
> > and if it doesn't match, generates a stale link.
> >
> > why doesn't it match?
> >
> > say you have a list of 1 object, and you iterate over it and generate an
> > input box for each item.
> >
> > If when submitting, the list has suddenly 2 objects, two input boxes are
> >
> > rendered, one too much...
> >
> > to prevent this, certain approaches were taken, including the For bean,
> > If bean ( i think...) and action listeners instead of "listener"
> > listeners.
> >
> > So - when doing thing in the right order and persisting the information
> > in the right place, stale link exceptions can be avoided - show me yours
> > and I'll show you mine (code)...
> >
> > Cheers,
> > Ron
> >
> >
> >
> >
> >
> > Andrea Chiumenti wrote:
> > > Hello,
> > > I'm using Tapestry 4.1.1 and I'm trying to update a comopnent.
> > > This component is a grid, that in normal state hasn't any input
> > component.
> > > The first time i call addNew, that adds a new row with input elements
> > all
> > > goes well.
> > > The next time i call this function I have a StaleLinkException.
> > >
> > > with this message:
> > > Rewind of form Home/thisForm expected allocated id #9 to be
> > 'nameField',
> > > but
> > > was 'addNew' (requested by component Home/tableForm.addNew).
> > >
> > > The call is an ajax call that updates the table containing the row.
> > >
> > > How can I prevent the stale link exception, how does Tapestry 4.1.1threats
> > > stale links ?
> > >
> > > Thanks in advance,
> > > kiuma
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>

Re: Stale link exception

Posted by Jesse Kuhnert <jk...@gmail.com>.
Tapestry should properly update all of your newly added components in
the local hidden fields of the form. The only time you'd get into
trouble is if you were somehow trying to do this yourself. (maybe? )

On 1/27/07, RonPiterman <rp...@gmx.net> wrote:
> I would say, break the form to (probably) 3 different ones:
> one before, one after and one *the* grid.
>
> You could use a nasty approach and, when editting a row in your gread
> using the EventListener component to clear all validation problems
> recorded before. This will however not work for validation problems
> which accure *after* your row :(
> So you could implement your own validation delegate which can choose
> which problems to record and which not to...
> Cheers,
> Ron
>
>
> Andrea Chiumenti wrote:
> > Thank you for your reply!
> >
> > I've understood my mistake: it was that I set volatile to true in two
> > places
> > I didn't have to.
> >
> > Backing to the normal behavior  now I can also provide the component
> > without
> > its own form.
> > Now I have another question: How can I pervent the validation of components
> > outside the grid when I add a row ?
> >
> > kiuma
> >
> > On 1/27/07, RonPiterman <rp...@gmx.net> wrote:
> >>
> >> first, I would not in any cas try to write my own form component.
> >>
> >> So, stale links:
> >>
> >> In order for tapestry to submit a form, all form components must be
> >> rendered on submit on the same order they were rendered for the response
> >> which generated the form.
> >>
> >> to make sure this happens, tapestry records the order of the components,
> >> and if it doesn't match, generates a stale link.
> >>
> >> why doesn't it match?
> >>
> >> say you have a list of 1 object, and you iterate over it and generate an
> >> input box for each item.
> >>
> >> If when submitting, the list has suddenly 2 objects, two input boxes are
> >> rendered, one too much...
> >>
> >> to prevent this, certain approaches were taken, including the For bean,
> >> If bean ( i think...) and action listeners instead of "listener"
> >> listeners.
> >>
> >> So - when doing thing in the right order and persisting the information
> >> in the right place, stale link exceptions can be avoided - show me yours
> >> and I'll show you mine (code)...
> >>
> >> Cheers,
> >> Ron
> >>
> >>
> >>
> >>
> >>
> >> Andrea Chiumenti wrote:
> >> > Hello,
> >> > I'm using Tapestry 4.1.1 and I'm trying to update a comopnent.
> >> > This component is a grid, that in normal state hasn't any input
> >> component.
> >> > The first time i call addNew, that adds a new row with input elements
> >> all
> >> > goes well.
> >> > The next time i call this function I have a StaleLinkException.
> >> >
> >> > with this message:
> >> > Rewind of form Home/thisForm expected allocated id #9 to be
> >> 'nameField',
> >> > but
> >> > was 'addNew' (requested by component Home/tableForm.addNew).
> >> >
> >> > The call is an ajax call that updates the table containing the row.
> >> >
> >> > How can I prevent the stale link exception, how does Tapestry
> >> 4.1.1threats
> >> > stale links ?
> >> >
> >> > Thanks in advance,
> >> > kiuma
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

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


Re: Stale link exception

Posted by RonPiterman <rp...@gmx.net>.
I would say, break the form to (probably) 3 different ones:
one before, one after and one *the* grid.

You could use a nasty approach and, when editting a row in your gread 
using the EventListener component to clear all validation problems 
recorded before. This will however not work for validation problems 
which accure *after* your row :(
So you could implement your own validation delegate which can choose 
which problems to record and which not to...
Cheers,
Ron


Andrea Chiumenti wrote:
> Thank you for your reply!
> 
> I've understood my mistake: it was that I set volatile to true in two 
> places
> I didn't have to.
> 
> Backing to the normal behavior  now I can also provide the component 
> without
> its own form.
> Now I have another question: How can I pervent the validation of components
> outside the grid when I add a row ?
> 
> kiuma
> 
> On 1/27/07, RonPiterman <rp...@gmx.net> wrote:
>>
>> first, I would not in any cas try to write my own form component.
>>
>> So, stale links:
>>
>> In order for tapestry to submit a form, all form components must be
>> rendered on submit on the same order they were rendered for the response
>> which generated the form.
>>
>> to make sure this happens, tapestry records the order of the components,
>> and if it doesn't match, generates a stale link.
>>
>> why doesn't it match?
>>
>> say you have a list of 1 object, and you iterate over it and generate an
>> input box for each item.
>>
>> If when submitting, the list has suddenly 2 objects, two input boxes are
>> rendered, one too much...
>>
>> to prevent this, certain approaches were taken, including the For bean,
>> If bean ( i think...) and action listeners instead of "listener"
>> listeners.
>>
>> So - when doing thing in the right order and persisting the information
>> in the right place, stale link exceptions can be avoided - show me yours
>> and I'll show you mine (code)...
>>
>> Cheers,
>> Ron
>>
>>
>>
>>
>>
>> Andrea Chiumenti wrote:
>> > Hello,
>> > I'm using Tapestry 4.1.1 and I'm trying to update a comopnent.
>> > This component is a grid, that in normal state hasn't any input
>> component.
>> > The first time i call addNew, that adds a new row with input elements
>> all
>> > goes well.
>> > The next time i call this function I have a StaleLinkException.
>> >
>> > with this message:
>> > Rewind of form Home/thisForm expected allocated id #9 to be 
>> 'nameField',
>> > but
>> > was 'addNew' (requested by component Home/tableForm.addNew).
>> >
>> > The call is an ajax call that updates the table containing the row.
>> >
>> > How can I prevent the stale link exception, how does Tapestry 
>> 4.1.1threats
>> > stale links ?
>> >
>> > Thanks in advance,
>> > kiuma
>> >
>>
>>
>> ---------------------------------------------------------------------
>> 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: Stale link exception

Posted by Andrea Chiumenti <ki...@gmail.com>.
Thank you for your reply!

I've understood my mistake: it was that I set volatile to true in two places
I didn't have to.

Backing to the normal behavior  now I can also provide the component without
its own form.
Now I have another question: How can I pervent the validation of components
outside the grid when I add a row ?

kiuma

On 1/27/07, RonPiterman <rp...@gmx.net> wrote:
>
> first, I would not in any cas try to write my own form component.
>
> So, stale links:
>
> In order for tapestry to submit a form, all form components must be
> rendered on submit on the same order they were rendered for the response
> which generated the form.
>
> to make sure this happens, tapestry records the order of the components,
> and if it doesn't match, generates a stale link.
>
> why doesn't it match?
>
> say you have a list of 1 object, and you iterate over it and generate an
> input box for each item.
>
> If when submitting, the list has suddenly 2 objects, two input boxes are
> rendered, one too much...
>
> to prevent this, certain approaches were taken, including the For bean,
> If bean ( i think...) and action listeners instead of "listener"
> listeners.
>
> So - when doing thing in the right order and persisting the information
> in the right place, stale link exceptions can be avoided - show me yours
> and I'll show you mine (code)...
>
> Cheers,
> Ron
>
>
>
>
>
> Andrea Chiumenti wrote:
> > Hello,
> > I'm using Tapestry 4.1.1 and I'm trying to update a comopnent.
> > This component is a grid, that in normal state hasn't any input
> component.
> > The first time i call addNew, that adds a new row with input elements
> all
> > goes well.
> > The next time i call this function I have a StaleLinkException.
> >
> > with this message:
> > Rewind of form Home/thisForm expected allocated id #9 to be 'nameField',
> > but
> > was 'addNew' (requested by component Home/tableForm.addNew).
> >
> > The call is an ajax call that updates the table containing the row.
> >
> > How can I prevent the stale link exception, how does Tapestry 4.1.1threats
> > stale links ?
> >
> > Thanks in advance,
> > kiuma
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Stale link exception

Posted by RonPiterman <rp...@gmx.net>.
first, I would not in any cas try to write my own form component.

So, stale links:

In order for tapestry to submit a form, all form components must be 
rendered on submit on the same order they were rendered for the response 
which generated the form.

to make sure this happens, tapestry records the order of the components, 
and if it doesn't match, generates a stale link.

why doesn't it match?

say you have a list of 1 object, and you iterate over it and generate an 
input box for each item.

If when submitting, the list has suddenly 2 objects, two input boxes are 
rendered, one too much...

to prevent this, certain approaches were taken, including the For bean, 
If bean ( i think...) and action listeners instead of "listener" listeners.

So - when doing thing in the right order and persisting the information 
in the right place, stale link exceptions can be avoided - show me yours 
and I'll show you mine (code)...

Cheers,
Ron





Andrea Chiumenti wrote:
> Hello,
> I'm using Tapestry 4.1.1 and I'm trying to update a comopnent.
> This component is a grid, that in normal state hasn't any input component.
> The first time i call addNew, that adds a new row with input elements all
> goes well.
> The next time i call this function I have a StaleLinkException.
> 
> with this message:
> Rewind of form Home/thisForm expected allocated id #9 to be 'nameField', 
> but
> was 'addNew' (requested by component Home/tableForm.addNew).
> 
> The call is an ajax call that updates the table containing the row.
> 
> How can I prevent the stale link exception, how does Tapestry 4.1.1 threats
> stale links ?
> 
> Thanks in advance,
> kiuma
> 


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