Hello Juergen,

thanks for your quick reply. As I'm still using 1.2.x (need something
stable...), I couldn't use your code 1:1, but had to change the
EmailPage() constructor like this (and the MyHtmlBodyContainer likewise)

public EmailPage()
{
        remove(BodyOnLoadHandler.BODY_ID);
        add(new MyHtmlBodyContainer(BodyOnLoadHandler.BODY_ID);
}

I hope I don't generate any anomalies with that, but so far this works
just fine!


Greetings,

Rüdiger

Juergen Donnerstag wrote:
> That is all what is needed
> 
> public class EmailPage extends WebPage
> {
>       private static final long serialVersionUID = 1L;
> 
>       /**
>        * Construct
>        *
>        */
>       public EmailPage()
>       {
>               new MyHtmlBodyContainer(this, BodyOnLoadHandler.BODY_ID);
>       }
>       
>       /**
>        *
>        */
>       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");
>               }
>       }
> }
> 
> Juergen
> 
> On 11/5/06, Juergen Donnerstag <[EMAIL PROTECTED]> wrote:
>> getPage().getBodyContainer().addXXX to add AttributeModifiers.
>>
>> If your Panel markup requires to contribute to body onload or onunload
>> than simply add a body tag to the panel markup including the attrs.
>> They'll be copied to the pages body tag.
>>
>> And <wicket:head> in a panels markup can be used if the Panel requires
>> to contribute to the pages header <head>.
>>
>> Provided I understand you correct, none of these solves your problem
>> of adding js right behind <body> and right before </body>. If've never
>> realy tried it but it should be sufficient to add
>>                 new MyHtmlBodyContainer(this, BodyOnLoadHandler.BODY_ID);
>>                 setBodyContainer(new BodyContainer(this, 
>> BodyOnLoadHandler.BODY_ID));
>> to your pages constructor. With
>> public class MyHtmlBodyContainer extends HtmlBodyContainer
>>
>> Though I not sure it is available in 1.2.X. Wich version are you using?
>>
>> Juergen
>>
>> On 11/5/06, Rüdiger Schulz <[EMAIL PROTECTED]> wrote:
>>> Hello everybody,
>>>
>>> is it possible to add to the body tag with a behaviour or something similar?
>>>
>>> I have one type of pages which needs some javascript included at the
>>> beginning of <body> and again right before </body>. All of my pages
>>> share a common parent class (providing the general layout etc. for all
>>> subpages), so in the markup of the sub-page I can only write new HTML in
>>> the wicket:extend part.
>>>
>>> I see there is a way to do this for the <head>, but I have found nothing
>>> about <body>. I looked at the source how these work, but I don't think
>>> this can be easily applied to body (The functionality comes from
>>> implementing IHeaderContributor, not from IBehavior, right?).
>>>
>>> To say it shortly: the classes in wicket.extensions.util.resource work
>>> fine, but I don't know how to apply one to the body  :)
>>>
>>>
>>> Any hints are welcome...
>>>
>>>
>>> greetings,
>>>
>>> Rüdiger Schulz
>>>
>>>
>>> -------------------------------------------------------------------------
>>> Using Tomcat but need to do more? Need to support web services, security?
>>> Get stuff done quickly with pre-integrated technology to make your job 
>>> easier
>>> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>>> _______________________________________________
>>> Wicket-user mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>>
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> 
> 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to