Of course, if you needed the movie list in your MovieList.java code
somewhere (eg. to display a count of the number of movies), then this
wouldn't suffice.
Instead you'd need to do something like this:
public List getMovies() {
IBinding movieListBinding = this.getBinding("movieList");
List movies = (List)movieListBinding.getObject("movieList", List.class);
return movies;
}
and go back to using your original movieList binding. Though note - you
still don't need the setMovies() method.
Of course, if you were really keen, you might cache some or all of the above
to save calculating it each time, but then you have to worry about cleaning
the cached values out etc. Easier not to bother - especially when starting
out. (But if you did want to go that way, you would typically start by
caching the binding object first - the developer guide shows how this works)
R
PS. You're not a WebObject'er are you?
----- Original Message -----
From: "Rowland Smith" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 26, 2002 9:11 AM
Subject: Re: [Tapestry-developer] binding problem
> 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