Jürgen and Igor once showed me how to do this:
http://www.nabble.com/BodyContributor--tf2578291.html#a7187578
http://www.nabble.com/Replacing-HtmlBodyContainer-tf3665340.html#a10241426
You need your own implementation of BodyContainer, and replace during
attachment. Something like this should work:
public clas MyPage extends WebPage {
public void onAttach() {
Component body=get(BodyOnLoadHandler.BODY_ID);
if (body!=null) {
if (!(body instanceof MyHtmlBodyContainer)) {
remove(BodyOnLoadHandler.BODY_ID );
body=null;
}
}
if (body==null) {
add(new ...);
}
}
/**
*
*/
public static class MyHtmlBodyContainer extends *HtmlBodyContainer*
{
private static final long serialVersionUID = 1L;
/**
* Construct
*
* @see Component#Component(MarkupContainer,String)
*/
public MyHtmlBodyContainer(MarkupContainer parent, final
String id)
{
super(parent, id);
}
@Override
protected void onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag)
{
getResponse().write("Something after the body open
tag");
super.onComponentTagBody(markupStream, openTag);
getResponse().write("Something before the body close
tag");
}
}
}
2007/9/24, legol <[EMAIL PROTECTED]>:
>
>
> Thx for reply,
> I'm using wicket 1.2.6, i have to add markup simply from String variable
> in
> class that extends from webpage
>
>
>
> Rüdiger_Schulz wrote:
> >
> > 2007/9/24, legol <[EMAIL PROTECTED]>:
> >>
> >>
> >> Hi all!!!
> >>
> >> What I want to do is append some markup to my webpage after body tag. I
> >> can't override onRender method in HTMLBodyContainer because it is
> created
> >> by
> >> method getBodyContainer() in WebPage.
> >
> >
> >
> > I had to do the same thing, and was able to solve it.
> >
> > To help you, I need to know what version of wicket you are using, and
> what
> > markup you want to add, where it should come from.
> >
> > --
> > greetings from Berlin,
> >
> > Rüdiger Schulz
> >
> > www.2rue.de
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Append-markup-to-BODY-container-tf4509327.html#a12863489
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
greetings from Berlin,
Rüdiger Schulz
www.2rue.de