我想让列表视图的项目,即表格单元格,可点击,以便它们发送到另一个页面。谁能让我知道我的问题是什么?提前致谢。
那是html: http: //pastebin.com/qUaPzTwv
这就是我正在尝试的
Application app = (Application) getApplication();
MovieCollection col = app.getCollection();
List<Movie> movies = col.getMovies();
add(new ListView("movie_list", movies) {
@Override
protected void populateItem(ListItem item) {
final Movie movie = (Movie) item.getModelObject();
item.add(new Label("title", movie.getTitle()));
item.add(new Label("year", Integer.toString(movie.getYear())));
item.add(new Link("movie_link") {
@Override
public void onClick() {
setResponsePage(new MoviePage(movie));
}
});
}
});
这就是输出:
Last cause: Unable to find component with id 'title' in [ [Component id = movie_link]]
Expected: 'movie_list:0:movie_link.title'.
Found with similar names: 'movie_list:0:title', movie_list:1:title', movie_list:2:title'