I made a mistake in my first post. The output of wasn't: <div> <div class="product">.....</div> <div class="product">.....</div> <div class="product">.....</div> <div class="product">.....</div> </div>
but it was: <div class="product">.....</div> <div class="product">.....</div> <div class="product">.....</div> <div class="product">.....</div> So the outer div is missing. Which is caused by item.setRenderBodyOnly(true). But if I disable (set to false) this (the default), I get: <div class="products"><div class="product">.....</div></div> <div class="products"><div class="product">.....</div></div> <div class="products"><div class="product">.....</div></div> <div class="products"><div class="product">.....</div></div> which is even worse. A solution (the only?) to this double div problem and at the same time the missing attribute problem, is using wicket:container tags. (see http://apache-wicket.1842946.n4.nabble.com/Panel-in-List-remove-extra-div-td1877053.html ) This leads to this solution: <div class="products"> <wicket:container wicket:id="products"> <div class="product" wicket:id="productPanel">.....</div> </wicket:container> </div> Wicket:container tags make it ugly imo, because it violates wickts "just HTML" philosophy, even though my problem is a very common scenario. > ----- Original Message ----- > From: Fatih Mehmet UCAR > Sent: 08/21/10 04:05 PM > To: users@wicket.apache.org > Subject: Re: setRenderBodyOnly with ListView and attributes > > Add another html div with css class you want around the below list div ; > > <div class="products" wicket:id="productsView"> > > and for the productsViev in the java code setRenderBodyOnly to true. > > -fmu > > > ----- Original Message ----- > From: "J" <bluecar...@gmx.com> > To: <users@wicket.apache.org> > Sent: Saturday, August 21, 2010 2:49 PM > Subject: Re: setRenderBodyOnly with ListView and attributes > > > > It somehow feels bad/wrong to move CSS from WicketHTML to JavaCode, where > > it shouldn't belong, for such a common scenario. > > It defeats the purpose of having HTML in Wicket. But there probably is no > > other way. > > > > Anyway, thanks for your reply :) > > > > > >> ----- Original Message ----- > >> > >> From: Fatih Mehmet UCAR > >> Sent: 08/21/10 03:43 PM > >> To: users@wicket.apache.org > >> Subject: Re: setRenderBodyOnly with ListView and attributes > >> > >> AttributeAppender class will help you to acheive that. > >> > >> -fmu > >> > >> ----- Original Message ----- > >> From: "J" <bluecar...@gmx.com> > >> To: <users@wicket.apache.org> > >> Sent: Saturday, August 21, 2010 2:24 PM > >> Subject: setRenderBodyOnly with ListView and attributes > >> > >> > >> > hi, I want to have Wicket to generate the following HTML precisely: > >> > > >> > <div class="products"> > >> > <div class="product">.....</div> > >> > <div class="product">.....</div> > >> > <div class="product">.....</div> > >> > <div class="product">.....</div> > >> > </div> > >> > > >> > But with my code, I don't get further than: > >> > > >> > <div> > >> > <div class="product">.....</div> > >> > <div class="product">.....</div> > >> > <div class="product">.....</div> > >> > <div class="product">.....</div> > >> > </div> > >> > > >> > so the class attribute is missing in the outer div. > >> > > >> > My Wicket HTML is: > >> > <div class="products" wicket:id="productsView"> > >> > <div class="product" wicket:id="productPanel">.....</div> > >> > </div> > >> > > >> > > >> > My code: > >> > ListView productsView = new ListView("productsView", products) { > >> > protected void populateItem(ListItem item) { > >> > item.setRenderBodyOnly(true); > >> > item.add(new ProductPanel("productPanel", item.getModelObject())); > >> > } > >> > }; > >> > add(productsView); > >> > > >> > > >> > What is the Wicket way of achieving this? > >> > (A solution is to use the wicket:container tag, but that's a bit ugly, > >> > right?) > >> > > >> > --------------------------------------------------------------------- > >> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > >> > For additional commands, e-mail: users-h...@wicket.apache.org > >> > > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > >> For additional commands, e-mail: users-h...@wicket.apache.org > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org