I'm afraid that parameters don't work quite the way you 
expect.  

Defining a parameter for a component means that Tapestry 
will attempt to set a property named xyzBinding (for 
parameter 'xyz') and the value is an instance of 
IBinding.

You can dereference your List by invoking 
binding.getValue().

The place to do this is in your render method:

public void render(....)
{
  IBinding moviesBinding = getBinding("movies");

  _movies = (List)moviesBinding.getValue("movies", 
List.class);

  super.render(...);

  _movies = null;
}


I've recently updated the developer guide FAQ with a 
discussion about this, but in summary:
- Is this too complicated? Yes.
- Why? To support the (rare) component that needs to 
update through its bindings.  I let the exceptional case 
make the common case very unpleasant!
- What can be done?  A bit of surgery!

I'll be opening this up for discussion, for inclusion
in 2.0.2 or 2.0.3 perhaps.  The problem is that any fix 
will break a lot of existing components.

See:
http://tapestry.javanuke.org/doc/DevelopersGuide/componen
ts.html#components.params


--
[EMAIL PROTECTED]

http://tapestry.sf.net
> On Thursday 25 April 2002 05:09 pm, you wrote:
> > Can you show us your MovieList.jwc file/contents?
> 
> Sure, here ya go.  I've include 
MovieList.jwc/html/java.
> 
> --MovieList.jwc---
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- $Id: Home.jwc,v 1.4 2001/05/22 15:24:16 hship Exp 
$ -->
> <!DOCTYPE specification PUBLIC "-//Howard 
Ship//Tapestry Specification 
> 1.1//EN" "http://tapestry.sf.net/dtd/Tapestry_1_1.dtd";>
> <specification class="movietime.components.MovieList">
> 
>   <parameter name="movies" java-type="java.lang.List" 
required="yes"/>
> 
>   <component id="movieList" type="Foreach">
>     <binding name="source" property-path="movies"/>
>     <binding name="value" property-path="movie"/>
>   </component>
> 
>   <component id="insertName" type="Insert">
>     <binding name="value" property-path="movie.name"/>
>   </component>
> 
>   <component id="insertTime" type="Insert">
>     <binding name="value" property-path="movie.time"/>
>   </component>
> 
>   <component id="insertDate" type="Insert">
>     <binding name="value" property-path="movie.date"/>
>   </component>
> 
>   <component id="insertLocation" type="Insert">
>     <binding name="value" property-
path="movie.location"/>
>   </component>
> 
> </specification>
> ---
> 
> ---MovieList.html---
> <table>
> <tr><td>dude</td></tr>
> <span jwcid="movieList">
> <tr>
> <td><span jwcid="insertName">The Sweetest 
Thing</span></td>
> <td><span jwcid="insertTime">8:00pm</span></td>
> <td><span jwcid="insertDate">4/18/2002</span></td>
> <td><span jwcid="insertLocation">Mission 
Valley</span></td>
> </tr>
> </span>
> </table>
> ---
> 
> --MovieList.java---
> package movietime.components ;
> 
> import movietime.model.Movie ;
> 
> import java.util.List ;
> 
> import com.primix.tapestry.BaseComponent;
> 
> public class MovieList extends BaseComponent
> {
>     private List    _movies ;
>     private Movie   _movie ;
> 
>     public MovieList()
>     {
>         super() ;
>         _movies = null ;
>         _movie = null ;
>     }
> 
>     public List getMovies()
>     {
>         return _movies;
>     }
> 
>     public void setMovies( List movies )
>     {
>         _movies = movies;
>     }
> 
>     public Movie getMovie()
>     {
>         return _movie;
>     }
> 
>     public void setMovie( Movie movie )
>     {
>         _movie = movie;
>     }
> }
> ---
> 
> > R
> >
> > ----- Original Message -----
> > From: "Rowland Smith" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, April 26, 2002 8:40 AM
> > Subject: [Tapestry-developer] binding problem
> >
> > > Hi,
> > >
> > > I'm a newbie to Tapestry, and I'm having a problem 
getting a custom
> >
> > component
> >
> > > to work.  I believe the problem is with a binding 
I have defined in my
> > > Home.jwc:
> > >
> > >   <component id="currentMovies"
> >
> > type="/movietime/components/MovieList.jwc">
> >
> > >     <binding name="movies" property-
path="visit.calendar.allMovies"/>
> > >   </component>
> > >
> > > The MovieList component consists of :
> > >    MovieList.java
> > >    MovieList.html
> > >    MovieList.jwc
> > >
> > > MovieList.java defines the following property:
> > >    movies : getMovies():List / setMovies(List)
> > >
> > > I know that the MovieList component is getting 
rendered when I load the
> >
> > Home
> >
> > > page ( I have some static HTML that I can see is 
getting inserted ).
> > >
> > > The problem is that the 'movies' property is not 
getting set.  It appears
> > > that the binding defined above in Home.jwc is 
never getting resolved.  I
> > > introduced an error into the 'property-path' ( 
visit.calendar.llMoves ),
> >
> > and
> >
> > > didn't get an exception, so the binding must not 
be getting resolved.
> > >
> > > I don't understand compelete the flow of Tapestry 
yet, so I'm clueless as
> >
> > to
> >
> > > why the binding resolution isn't happening.
> > >
> > > Any help would be greatly appreciated - I really 
like Tapestry so far and
> > > want to move on to the next level :)
> > >
> > > Thanks in advance,
> > > Rowland
> > >
> > > _______________________________________________
> > > Tapestry-developer mailing list
> > > [EMAIL PROTECTED]
> > > 
https://lists.sourceforge.net/lists/listinfo/tapestry-
developer
> >
> > _______________________________________________
> > Tapestry-developer mailing list
> > [EMAIL PROTECTED]
> > 
https://lists.sourceforge.net/lists/listinfo/tapestry-
developer
> 
> _______________________________________________
> Tapestry-developer mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/tapestry-
developer

_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer

Reply via email to