On Thu, 11 Oct 2012 11:40:00 -0300, Ken in Nashua <kcola...@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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to