ListView newsDetails = new ListView("newsDetails", new LoadableDetachableModel(new PropertyModel(this, "articles")))
-igor On Tue, Apr 29, 2008 at 10:46 AM, Andrew Broderick <[EMAIL PROTECTED]> wrote: > Hi, > > I have a page where I am using a PropertyModel to populate a ListView, so it > will change when the underlying contents change: > > ListView newsDetails = new ListView("newsDetails", new > PropertyModel(this, "articles")) > { > protected void populateItem(ListItem item) > { > > final NewsDetails nd = (NewsDetails) > item.getModelObject(); > item.add(new Label("articleDate", > nd.getArticleDate())); > item.add(new Label("articleTime", > nd.getArticleTime())); > item.add(new Label("newsShortDesc", > nd.getNewsShortDesc())); > newsUrlLink.add(new Label("newsTitle", > nd.getNewsTitle())); > item.add(newsUrlLink); > } > }; > add(newsDetails); > > The page class, obviously, has a getter named getArticles(): > > > public List<NewsDetails> getArticles() > { > .... > } > > However, this seems to get called multiple times when the listview is being > populated, not just once at the beginning of each time the page is displayer. > Why is this happening? It results in many more hits to the database than are > necessary. > > Thanks, > > Andrew B > > _______________________________________________________ > > The information in this email or in any file attached > hereto is intended only for the personal and confiden- > tial use of the individual or entity to which it is > addressed and may contain information that is propri- > etary and confidential. If you are not the intended > recipient of this message you are hereby notified that > any review, dissemination, distribution or copying of > this message is strictly prohibited. This communica- > tion is for information purposes only and should not > be regarded as an offer to sell or as a solicitation > of an offer to buy any financial product. Email trans- > mission cannot be guaranteed to be secure or error- > free. P6070214 > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]