If it's saying that it can't find a strategy for class Foo, then that means
that it's trying to "squeeze" it (if you wrote a class named Charmin, would
it say "I can't squeeze the Charmin"?).  The reason it's trying to squeeze
it is because you're using the @For component ("it will automatically store
the collection in Hidden fields so that the structure of the page is
preserved when the form is submitted").  So, either provide a custom
squeezer for your Foo class or just make it serializable.

-----Original Message-----
From: Norbert Sándor [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 23, 2006 4:33 AM
To: Tapestry users
Subject: Re: Persistent Set

You CAN embed For in Form. Actually For supports Form more closely by 
the "volatile" parameter.

"Could not find a strategy instance for class Foo.": maybe your Foo is not
serializable, so it cannot be stored in the session? (And you haven't
provided a custom squeezer.)

Set, Map or other collections cannot be stored in the session properly by
default.
The problem is that Tapestry does not realize when you modify the
collection, so it won't be updated in the session.
I've solved this by creating a thin wrapper implementation of Set, Map &
List, which calls Tapestry.fireObservedChange() in the modifier methods
(like add(), remove(), clear(), etc.).

I hope this helps to solve your problem (maybe by seeing your real source
code would help more).

Regards,
Norbi

Todd Orr wrote:
> Problem solved. Looks like I cannot embed the For in the Form element.
> Thanks again.
>
> On 4/22/06, Todd Orr <[EMAIL PROTECTED]> wrote:
>   
>> Also, there is a For component on the page the attempts to display all
>> the Foos that have been created thus far. I think this is where the
>> problem is. If I remove the For, it works, but now my user has no idea
>> how many/which Foos she's already created.
>>
>> Thanks.
>>
>> On 4/22/06, Todd Orr <[EMAIL PROTECTED]> wrote:
>>     
>>> I've got a form page that creates new foos, one after another. You
>>> input foo data and each time a new foo will be added to the persistent
>>> foo set. I am doing this in an attempt to collect multiple foos for
>>> bulk processing on subsequent pages. The page has the method:
>>>
>>> @Persist
>>> public abstract Set<Foo> getFoos();
>>> public abstract void setFoos(Set<Foo> foos);
>>>
>>> The template has a submit that call the addAnotherFoo listener. The
>>> addAnotherFoo method looks like:
>>>
>>> public IPage addAnotherOfficer() {
>>>
>>>         getFoos().add(getFoo());
>>>
>>>         for (Foo o : getFoos())
>>>
>>>                 System.out.println(o.getId());
>>>
>>>         return this;
>>>
>>> }
>>>
>>> After setting a breakpoint, I can see that there are no errors.
>>> However, when the addAnotherFoo listener gets called I get the
>>> following Tapestry Exception:
>>>
>>> Could not find a strategy instance for class Foo.
>>>
>>> etc.
>>>
>>> What is Tapestry trying to do? Are there better approaches to what I
>>> am trying to do? Thanks in advance.
>>>
>>> T
>>>
>>>       
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to