You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by itayh <it...@attractv.net> on 2008/11/25 15:08:46 UTC

onLoad javascript event with Markup inheritance

Hi,

I use Markup inheritance in my site in order to keep common logic in the
base page. 
I would like my child pages to do certain javascript actions when they are
loaded. I try to define the the javascript on the childs body (between the
<wicket:extend> and </wicket:extend>) but I don't see them in the generated
page (the base + child page). Any Idea how to generate onLoad javascript
action for child page?
-- 
View this message in context: http://www.nabble.com/onLoad-javascript-event-with-Markup-inheritance-tp20681885p20681885.html
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: onLoad javascript event with Markup inheritance

Posted by itayh <it...@attractv.net>.
Thank you, it works great.


jWeekend wrote:
> 
> You can use <wicket:head> or HeaderContributors.
> See  http://cwiki.apache.org/WICKET/javascript-and-css-support.html this .
> 
> Regards - Cemal
>  http://www.jWeekend.co.uk http://jWeekend.co.uk 
> 
> 
> itayh wrote:
>> 
>> Hi,
>> 
>> I use Markup inheritance in my site in order to keep common logic in the
>> base page. 
>> I would like my child pages to do certain javascript actions when they
>> are loaded. I try to define the the javascript on the childs body
>> (between the <wicket:extend> and </wicket:extend>) but I don't see them
>> in the generated page (the base + child page). Any Idea how to generate
>> onLoad javascript action for child page?
>> 
>  http://cwiki.apache.org/WICKET/javascript-and-css-support.html
> http://cwiki.apache.org/WICKET/javascript-and-css-support.html 
> 

-- 
View this message in context: http://www.nabble.com/onLoad-javascript-event-with-Markup-inheritance-tp20681885p20682858.html
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: onLoad javascript event with Markup inheritance

Posted by jWeekend <jw...@cabouge.com>.
You can use <wicket:head> or HeaderContributors.
See  http://cwiki.apache.org/WICKET/javascript-and-css-support.html this .

Regards - Cemal
http://www.jWeekend.co.uk http://jWeekend.co.uk 


itayh wrote:
> 
> Hi,
> 
> I use Markup inheritance in my site in order to keep common logic in the
> base page. 
> I would like my child pages to do certain javascript actions when they are
> loaded. I try to define the the javascript on the childs body (between the
> <wicket:extend> and </wicket:extend>) but I don't see them in the
> generated page (the base + child page). Any Idea how to generate onLoad
> javascript action for child page?
> 
http://cwiki.apache.org/WICKET/javascript-and-css-support.html
http://cwiki.apache.org/WICKET/javascript-and-css-support.html 
-- 
View this message in context: http://www.nabble.com/onLoad-javascript-event-with-Markup-inheritance-tp20681885p20682066.html
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: onLoad javascript event with Markup inheritance

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
that would be a cleaner solution, indeed... but normally I use at most a
couple of pages and lot of  panel replacements so each component just
contributes what it needs...
On Tue, Nov 25, 2008 at 3:32 PM, Serkan Camurcuoglu <
Serkan.Camurcuoglu@telenity.com> wrote:

> you should implement the IHeaderContributor interface in your page and use
> IHeaderResponse.renderOnLoadJavascript() method in the implementation of the
> renderHead method..
>
>
>
>
> Ernesto Reinaldo Barreiro wrote:
>
>> Something like:
>>
>> HTML
>>
>> <wicket:extend>   <script wicket:id="script"
>> type="text/javascript">alert('Hi');</script>
>>      .....
>> </wicket:extend>
>>
>> Java code:
>>
>> Label script = new Label("script", new Model<String>()) {
>> private static final long serialVersionUID = 1L;
>>
>> @Override
>> protected void onComponentTagBody(MarkupStream markupStream, ComponentTag
>> openTag) {
>> StringBuffer sb = new StringBuffer();
>> sb.append("var ");
>> // some more Javascript code...
>> replaceComponentTagBody(markupStream, openTag, sb.toString());
>> }
>> };
>> addOrReplace(script);
>>
>> does not work? I use that kind of things for panel and works just fine...
>> That should also work for extend...
>>
>> Best,
>>
>> Ernesto
>>
>> On Tue, Nov 25, 2008 at 3:08 PM, itayh <it...@attractv.net> wrote:
>>
>>
>>
>>> Hi,
>>>
>>> I use Markup inheritance in my site in order to keep common logic in the
>>> base page.
>>> I would like my child pages to do certain javascript actions when they
>>> are
>>> loaded. I try to define the the javascript on the childs body (between
>>> the
>>> <wicket:extend> and </wicket:extend>) but I don't see them in the
>>> generated
>>> page (the base + child page). Any Idea how to generate onLoad javascript
>>> action for child page?
>>> --
>>> View this message in context:
>>>
>>> http://www.nabble.com/onLoad-javascript-event-with-Markup-inheritance-tp20681885p20681885.html
>>> 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
>>>
>>>
>>>
>>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: onLoad javascript event with Markup inheritance

Posted by Serkan Camurcuoglu <Se...@telenity.com>.
you should implement the IHeaderContributor interface in your page and 
use IHeaderResponse.renderOnLoadJavascript() method in the 
implementation of the renderHead method..



Ernesto Reinaldo Barreiro wrote:
> Something like:
>
> HTML
>
> <wicket:extend>   <script wicket:id="script"
> type="text/javascript">alert('Hi');</script>
>       .....
> </wicket:extend>
>
> Java code:
>
> Label script = new Label("script", new Model<String>()) {
> private static final long serialVersionUID = 1L;
>
> @Override
> protected void onComponentTagBody(MarkupStream markupStream, ComponentTag
> openTag) {
> StringBuffer sb = new StringBuffer();
> sb.append("var ");
> // some more Javascript code...
> replaceComponentTagBody(markupStream, openTag, sb.toString());
> }
> };
> addOrReplace(script);
>
> does not work? I use that kind of things for panel and works just fine...
> That should also work for extend...
>
> Best,
>
> Ernesto
>
> On Tue, Nov 25, 2008 at 3:08 PM, itayh <it...@attractv.net> wrote:
>
>   
>> Hi,
>>
>> I use Markup inheritance in my site in order to keep common logic in the
>> base page.
>> I would like my child pages to do certain javascript actions when they are
>> loaded. I try to define the the javascript on the childs body (between the
>> <wicket:extend> and </wicket:extend>) but I don't see them in the generated
>> page (the base + child page). Any Idea how to generate onLoad javascript
>> action for child page?
>> --
>> View this message in context:
>> http://www.nabble.com/onLoad-javascript-event-with-Markup-inheritance-tp20681885p20681885.html
>> 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
>>
>>
>>     
>
>   


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


Re: onLoad javascript event with Markup inheritance

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Something like:

HTML

<wicket:extend>   <script wicket:id="script"
type="text/javascript">alert('Hi');</script>
      .....
</wicket:extend>

Java code:

Label script = new Label("script", new Model<String>()) {
private static final long serialVersionUID = 1L;

@Override
protected void onComponentTagBody(MarkupStream markupStream, ComponentTag
openTag) {
StringBuffer sb = new StringBuffer();
sb.append("var ");
// some more Javascript code...
replaceComponentTagBody(markupStream, openTag, sb.toString());
}
};
addOrReplace(script);

does not work? I use that kind of things for panel and works just fine...
That should also work for extend...

Best,

Ernesto

On Tue, Nov 25, 2008 at 3:08 PM, itayh <it...@attractv.net> wrote:

>
> Hi,
>
> I use Markup inheritance in my site in order to keep common logic in the
> base page.
> I would like my child pages to do certain javascript actions when they are
> loaded. I try to define the the javascript on the childs body (between the
> <wicket:extend> and </wicket:extend>) but I don't see them in the generated
> page (the base + child page). Any Idea how to generate onLoad javascript
> action for child page?
> --
> View this message in context:
> http://www.nabble.com/onLoad-javascript-event-with-Markup-inheritance-tp20681885p20681885.html
> 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
>
>