You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Koen Segers <Ko...@scarlet.be> on 2005/04/06 13:58:13 UTC

Property selection

Hi,

In my removeUser page I use a property selection to show what users can be 
removed. All works well, except if you press the back button without 
refreshing. I read in the Tapestry in Action book that normally this problem 
is solved by using a hidden field inside the form.

This is what I get from html.
<form method="POST" name="Form0" action="/koen/app">
<input type="hidden" name="service" 
value="direct/1/RemoveUser/RemoveUserForm"/>
<input type="hidden" name="sp" value="S0"/>

<input type="hidden" name="Form0" value="UsersList"/>
...


The UsersList is the property selection defined in the .page:
<component id="UsersList" type="PropertySelection">
        <binding name="model" expression="AvailableUsers"/>
        <binding name="value" expression="UserName"/>
    </component>


So all this is correct. Except when the userslist isn't the same as before. 
Therefore I was thinking to add the different usernames to the hidden field. 
But how can I do this?
Will it solve my problem?
If it doesn't how is the solution then?

Greetz
-- 

Koen Segers

<ko...@scarlet.be>
<http://eddyvite.dyndns.org>

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


Re: Property selection

Posted by Koen Segers <Ko...@scarlet.be>.
On Monday 11 April 2005 03:21, Kent Tong wrote:
> The list of available users must be serializable. So, you
> may change getAvailableUsers() to return an array or a
> java.util.List. Then have a separate method like
> getAvailableUsersModel() to return a property selection
> model.

I see your point. But isn't it possible to do the checking before the 
rendering? Like it is possible with ListEdit.

It works now (with a little hack). But I believe it can be a lot nicer :)

Thank you for your help!

-- 

Koen Segers

<ko...@scarlet.be>
<http://eddyvite.dyndns.org>

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


Re: Property selection

Posted by Kent Tong <ke...@cpttm.org.mo>.
Koen Segers <KoenSegers <at> scarlet.be> writes:

> 
> On Friday 08 April 2005 06:17, Kent Tong wrote:
> >  <input type="hidden" jwcid=" <at> Hidden" value="ognl: AvailableUsers"/>
> 
> I tried this. Unfortunatly I get this error all the time.
> Could not find an adaptor for class 
> org.apache.tapestry.form.StringPropertySelectionModel.

The list of available users must be serializable. So, you
may change getAvailableUsers() to return an array or a
java.util.List. Then have a separate method like 
getAvailableUsersModel() to return a property selection
model.



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


Re: Property selection

Posted by Koen Segers <Ko...@scarlet.be>.
On Friday 08 April 2005 06:17, Kent Tong wrote:
>  <input type="hidden" jwcid="@Hidden" value="ognl: AvailableUsers"/>

I tried this. Unfortunatly I get this error all the time.
Could not find an adaptor for class 
org.apache.tapestry.form.StringPropertySelectionModel.
Stack Trace:

    
*org.apache.tapestry.util.AdaptorRegistry.searchForAdaptor(AdaptorRegistry.java:263)
    
*org.apache.tapestry.util.AdaptorRegistry.getAdaptor(AdaptorRegistry.java:152)
    * org.apache.tapestry.util.io.DataSqueezer.squeeze(DataSqueezer.java:170)
    * org.apache.tapestry.form.Hidden.renderComponent(Hidden.java:65)
    * org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
    * 
org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:624)
    * org.apache.tapestry.form.Form.renderComponent(Form.java:362)
    * org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
    * 
org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:118)
    * org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
    * org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:300)
    * 
org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:368)
    * 
org.apache.tapestry.engine.AbstractEngine.renderResponse(AbstractEngine.java:732)
    * org.apache.tapestry.engine.PageService.service(PageService.java:77)
    * 
org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:872)
    * 
org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:197)
    * 
org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:158)


Any ideas?

I implemented the setAvailableUsers, but it is never called.
I added the hidden line you gave to my html.
What else is needed?

greetz

-- 

Koen Segers

<ko...@scarlet.be>
<http://eddyvite.dyndns.org>

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


Re: Property selection

Posted by Kent Tong <ke...@cpttm.org.mo>.
Koen Segers <KoenSegers <at> scarlet.be> writes:

> This is what I get from html.
> <form method="POST" name="Form0" action="/koen/app">
> <input type="hidden" name="service" 
> value="direct/1/RemoveUser/RemoveUserForm"/>
> <input type="hidden" name="sp" value="S0"/>
> 
> <input type="hidden" name="Form0" value="UsersList"/>

You should store the user list instead of the user list
component into the hidden field:

 <input type="hidden" jwcid="@Hidden" value="ognl: AvailableUsers"/>

Make sure you have a setAvailableUsers() method.



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