You've bound the parameter _currentPage to the value obtained from
${currentPage}.

Expansions are always read-only.  prop:currentPage is read/write, but
${currentPage} is read-only.

The instance variable in the component is always reading or updating the
binding.  So if you update _currentPage its going to try to update the
binding to match the new value; for ${currentPage} this fails (as it is a
read-only binding).

There may be a bug here, however.  It looks like Tapestry may be overly
aggressive in terms of caching the value of ${currentPage}, as if it were a
literal value and not a dynamic expression.  Again, prop:currentPage will do
the right thing.


On 7/20/07, Martin Grotzke <[EMAIL PROTECTED]> wrote:

Anybody out there?

What should I check for analysing this issue?

Thanx && cheers,
Martin


On Fri, 2007-07-13 at 18:17 +0200, Martin Grotzke wrote:
> I suppose that what I'm expecting is not the way it should work.
>
> Can I do anything to see what's the reason for this?
>
> Any help appreciated,
> thx,
> Martin
>
>
> On Thu, 2007-07-12 at 09:43 +0200, Martin Grotzke wrote:
> > On Thu, 2007-07-12 at 08:45 +0200, Kristian Marinkovic wrote:
> > >
> > > hi martin,
> > >
> > > try to set the "cache" attribute of your  @Parameter
> > > annotation of your "currentPage" component parameter
> > > to false
> > I tried that, but it didn't solve the issue - same behavior. Debugging
> > showed that _$currentPage_cached is still true...
> >
> >
> > Then I tried to "reset" the currentPage property manually and added
> >
> > _currentPage = 0;
> >
> > to the start of the beginRender method, which produced the following
> > error:
> >
> > Failure writing parameter currentPage of component Search:pager:
Binding
> > [EMAIL PROTECTED]
> > is read-only.
> >
> > Is there another way of resetting a parameter binding?
> >
> > How is it intended to work, when is a cached parameter reset?
> >
> > Thanx && cheers,
> > Martin
> >
> >
> > >
> > >
> > > @Parameter(cache=false,...)
> > >
> > > g,
> > > kris
> > >
> > >
> > >
> > > Martin Grotzke
> > > <[EMAIL PROTECTED]>
> > >
> > > 11.07.2007 22:20
> > >         Bitte antworten an
> > >          "Tapestry users"
> > >     <users@tapestry.apache.org>
> > >
> > >
> > >
> > >
> > >                An
> > > Tapestry users
> > > <users@tapestry.apache.org>
> > >             Kopie
> > >
> > >             Thema
> > > T5 component
> > > parameter binding
> > > not updated
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Hi,
> > >
> > > I wrote a simple pager component but one parameter (currentPage)
> > > is not updated in a second request.
> > >
> > > In the template I have the following:
> > >
> > >    <t:pager t:numberOfPages="${numberOfPages}"
> > >        t:currentPage="${currentPage}"
> > >        ... some other attributes ... />
> > >
> > > In the page class this currentPage accessor:
> > >
> > >    public int getCurrentPage() {
> > >        return _currentPage;
> > >    }
> > >
> > > which is an int and has the correct values in all requests.
> > >
> > > The pager component contains this currentPage property
> > >
> > >    @Parameter(required = true, defaultPrefix="prop")
> > >    private Integer _currentPage;
> > >
> > > which is used in
> > >
> > >    @BeginRender
> > >    boolean beginRender( MarkupWriter writer )
> > >
> > > which returns false (no other render methods, no template).
> > >
> > > When I debug the code I see, that the first time, the _currentPage
is
> > > accessed, the pages getCurrentPage method is invoked.
> > > In all subsequent page requests, the value of the first request is
> > > still stored and not updated.
> > >
> > > What am I doing wrong, or should T5 behave differently?
> > >
> > > Do I have to take any action to unbind/uncache/reset the currentPage
> > > property in the pager component?
> > >
> > > Thanx && cheers,
> > > Martin
> > >
> > >
> > >
> > >
---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
--
Martin Grotzke
http://www.javakaffee.de/blog/




--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

Reply via email to