You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by legol <le...@poczta.onet.pl> on 2007/09/24 15:51:10 UTC

Append markup to BODY container

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.

Pls help
-- 
View this message in context: http://www.nabble.com/Append-markup-to-BODY-container-tf4509327.html#a12860355
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Append markup to BODY container

Posted by legol <le...@poczta.onet.pl>.
Thx for help, It works now great.


Rüdiger_Schulz wrote:
> 
> 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 <le...@poczta.onet.pl>:
>>
>>
>> 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 <le...@poczta.onet.pl>:
>> >>
>> >>
>> >> 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: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 
> -- 
> 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#a12874626
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Append markup to BODY container

Posted by Rüdiger Schulz <ru...@googlemail.com>.
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 <le...@poczta.onet.pl>:
>
>
> 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 <le...@poczta.onet.pl>:
> >>
> >>
> >> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
greetings from Berlin,

Rüdiger Schulz

www.2rue.de

Re: Append markup to BODY container

Posted by legol <le...@poczta.onet.pl>.
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 <le...@poczta.onet.pl>:
>>
>>
>> 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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Append markup to BODY container

Posted by Rüdiger Schulz <ru...@googlemail.com>.
2007/9/24, legol <le...@poczta.onet.pl>:
>
>
> 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