You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ken in Nashua <kc...@live.com> on 2012/10/11 16:40:00 UTC
readonly parameter binding issue
Folks,
my Gallery component operates a parameter CURSOR
Gallery.JAVA
@Property
@Parameter(required = true, cache = true, defaultPrefix = "0")
private int cursor;
So my component has a read/write property that I use as a parameter.
In order to update it across request cycles/pages I modeled it as a property in the containing page HOME.TML
Home.JAVA
@Property
private int cursor;
I dont know why i am getting this error below... i thought I modeled this properly... didnt I?
thanks for any clarification on this. my T5 gallery is looking sweet so far. hope to publish soon.
Failure writing parameter 'cursor' of
component Home:gallerywidget: Binding
org.apache.tapestry5.internal.services.AttributeExpansionBinding@217796
is read-only.locationcontext:Home.tml, line 3631 <t:Gallery t:id="galleryWidget" id="galleryWidget"32 collectionType="${coachClass}"33 itemsPerPage="${itemsPerPage}"34 tableColumns="${tableColumns}"35 cursor="${cursor}"36 />37
38 </t:form>
Re: readonly parameter binding issue
Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 11 Oct 2012 11:40:00 -0300, Ken in Nashua <kc...@live.com>
wrote:
> Folks,
Hi!
> my Gallery component operates a parameter CURSOR
>
> Gallery.JAVA
> @Property
> @Parameter(required = true, cache = true, defaultPrefix = "0")
> private int cursor;
You're confusing defaultPrefix with default parameter value (which is the
'value' attribute of @Parameter). Remove the defaultPrefix declaration. In
addition, as this parameter is meant to be used as a cursor, setting it to
a default value doesn't make much sense to me.
> So my component has a read/write property that I use as a parameter.
>
> In order to update it across request cycles/pages I modeled it as a
> property in the containing page HOME.TML
>
> Home.JAVA
> @Property
> private int cursor;
>
> I dont know why i am getting this error below... i thought I modeled
> this properly... didnt I?
Yep. The error is elsewhere.
> Failure writing parameter 'cursor' of
> component Home:gallerywidget: Binding
> org.apache.tapestry5.internal.services.AttributeExpansionBinding@217796
> is read-only.locationcontext:Home.tml, line 3631 <t:Gallery
> t:id="galleryWidget"
> id="galleryWidget"32 collectionType="${coachClass}"33 itemsPerPage="${itemsPerPage}"34 tableColumns="${tableColumns}"35 cursor="${cursor}"36 />37
> 38 </t:form>
It's a common mistake. :) Never, never, ever use ${} expansions when
passing parameters to a component. I've posted the reason many times in
the mailing list and I'm lazy now, so I won't repeat it here. :P
It should have been:
<t:Gallery t:id="galleryWidget" id="galleryWidget"32
collectionType="coachClass" itemsPerPage="itemsPerPage"
tableColumns="tableColumns" cursor="cursor"/>
--
Thiago H. de Paula Figueiredo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: readonly parameter binding issue
Posted by Lance Java <la...@googlemail.com>.
For persistance between requests, your first consideration should always be
activation context (see @PageActivationContext or onActivate() /
onPassivate()). This will store values as part of the URL.
If activation context does not solve the problem, you should then consider
@Persist to either store in the HTTPSession or user cookie.
--
View this message in context: http://tapestry.1045711.n5.nabble.com/readonly-parameter-binding-issue-tp5716792p5716799.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: readonly parameter binding issue
Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 11 Oct 2012 15:34:44 -0300, Ken in Nashua <kc...@live.com>
wrote:
> maybe defaultPrefix should have been called bindingPrefix or
> defaultBindingPrefix?
In this case, 'prefix', in parameters, can only refer to binding prefixes,
so I think the name is clear enough.
I didn't want to burn you. If you search the mailing list archives, you'll
see a lot of "never, never, ever use expansions when passing parameters
values" posts. :P That's a common mistake to do, so don't worry about not
being able to avoid it before. :)
--
Thiago H. de Paula Figueiredo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: readonly parameter binding issue
Posted by Ken in Nashua <kc...@live.com>.
maybe defaultPrefix should have been called bindingPrefix or defaultBindingPrefix?
I get sort of dyslexic... and yes the default is what took me
From: kcolassi@live.com
To: users@tapestry.apache.org
Subject: RE: readonly parameter binding issue
Date: Thu, 11 Oct 2012 14:27:17 -0400
burn me beautiful Thiago...
thanks
I will give that a shot... and keep note of these special best practices
you will be the first one to see this gallery
i am working on the autopaging button handlers now
I wonder whatever happened to tacos... and jfly... andrea chiumante had some nice stuff there
wonderin if those guys ever folded into the T5 space
- cheers
:)
RE: readonly parameter binding issue
Posted by Ken in Nashua <kc...@live.com>.
burn me beautiful Thiago...
thanks
I will give that a shot... and keep note of these special best practices
you will be the first one to see this gallery
i am working on the autopaging button handlers now
I wonder whatever happened to tacos... and jfly... andrea chiumante had some nice stuff there
wonderin if those guys ever folded into the T5 space
- cheers
:)
RE: readonly parameter binding issue
Posted by Ken in Nashua <kc...@live.com>.
Thanks Lance... I know it might be asking alot...
is there a small snippet code example you could post?
this thing is coming along great
kcolassi@live.com
From: kcolassi@live.com
To: users@tapestry.apache.org
Subject: readonly parameter binding issue
Date: Thu, 11 Oct 2012 10:40:00 -0400
Folks,
my Gallery component operates a parameter CURSOR
Gallery.JAVA
@Property
@Parameter(required = true, cache = true, defaultPrefix = "0")
private int cursor;
So my component has a read/write property that I use as a parameter.
In order to update it across request cycles/pages I modeled it as a property in the containing page HOME.TML
Home.JAVA
@Property
private int cursor;
I dont know why i am getting this error below... i thought I modeled this properly... didnt I?
thanks for any clarification on this. my T5 gallery is looking sweet so far. hope to publish soon.
Failure writing parameter 'cursor' of
component Home:gallerywidget: Binding
org.apache.tapestry5.internal.services.AttributeExpansionBinding@217796
is read-only.locationcontext:Home.tml, line 3631 <t:Gallery t:id="galleryWidget" id="galleryWidget"32 collectionType="${coachClass}"33 itemsPerPage="${itemsPerPage}"34 tableColumns="${tableColumns}"35 cursor="${cursor}"36 />37
38 </t:form>