Why do you have two components on "bodyElement" ? WebMarkupContainer body = new WebMarkupContainer("bodyElement");
add(new WebMarkupContainer("bodyElement") { On Thu, Sep 23, 2010 at 11:00 AM, Ole Hansen <ssej1...@gmail.com> wrote: > Hi, > > Newbee question: I need to add the onload attribute to the body tag (I > can't use other methods to accomplish the same thing...) > > My html: > <html> > <wicket:head> > ... > </wicket:head> > <wicket:extend> > <body wicket:id="bodyElement"> > ... > </body> > </wicket:extend> > </html> > > Java: > WebMarkupContainer body = new WebMarkupContainer("bodyElement"); > > add(new WebMarkupContainer("bodyElement") { > @Override > public boolean isTransparentResolver() { > return true; > } > @Override > protected void onComponentTag(final ComponentTag tag) { > super.onComponentTag(tag); > tag.put("onload", "onload();"); > } > }); > > Result html: > <html> > <head> > ... > </head> > <body> > <body onload="onload();"> > ... > > I now have two body start tags. > The code below results in a runtime exception stating that bodyElement > was not declared.. > > <body wicket:id="bodyElement"> > <wicket:extend> > ... > </wicket:extend> > </body> > </html> > > I have also tried adding: > add(new BodyTagAttributeModifier("onload", true, new Model("onload();"), > this)); > > But nothing gets added to the body tag. > > Can someone direct me in the right direction? > > > Wicket version: 1.4.1 > JDK: IBM JDK 5.0.10 > > Regards, > Jess > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >