Hi, So you want to not have <a> (because this is what .setRenderBodyOnly(true) does) and in the same time you want to set a class an that non-existing tag ?!
The easiest way is to remove the call to .setRenderBodyOnly(true). On Wed, Feb 22, 2012 at 11:38 AM, Daniel Stoch <daniel.st...@gmail.com> wrote: > Hi, > > Is it possible to modify tag attribute (eg. add a CSS class) of > component which has set renderBodyOnly flag to true? > When using component.add(new AttributeModifier(...)) it has no effect, > because a tag in which this class attribute is appended is not > rendered in HTML (because of setRenderBodyOnly(true)). > > Here is an example: > LinkContainer is a component (extends Panel) which has > setRenderBodyOnly(true). > > <wicket:panel> > <a wicket:id="link"><wicket:container wicket:id="linkContent">[link > content]</wicket:container></a> > </wicket:panel> > > Somewhere inside a page or panel: > add(new LinkContainer("link", ...).add(new AttributeModifier("class", > Model.of("my-link-style")))); > But of course this " class='my-link-style' " will not be rendered anywhere. > > I want to add a class attribute to contained <a> tag but using a > behavior which can be added to the whole LinkContainer. Is it any > simple solution to achieve this? > > -- > DS > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org