You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by fachhoch <fa...@gmail.com> on 2009/03/28 00:03:20 UTC
adding css and js to header
and my header section already has some java script code
<script type="text/javascript">
function jqCheckAll(){
$("INPUT[type='checkbox']").attr('checked',
$('#checkAllAuto').is(':checked'));
}
</script>
<script type="text/javascript">
window.onload = setupFunc();
</script>
from my page I am adding JS file using response.render(), the problem is
wickets adds the script and css at the end of the my code in header section
so all my java script functions defined will not work , is there a way to
add the js and css at the top of my code in header section ?
for eaxmple this my html
<head>
<script>
my java script code
</script>
</head>
when page is rendered
<head>
<script>
my java script code
</script>
<link rel="stylesheet" type="text/css"
href="../../***********.css.CSSPATH/pagemask.js" />
</head>
i want this
<head>
<link rel="stylesheet" type="text/css"
href="../../***********.css.CSSPATH/pagemask.js" />
<script>
my java script code
</script>
</head>
how to get this ?
--
View this message in context: http://www.nabble.com/adding-css-and-js-to-header-tp22751518p22751518.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: adding css and js to header
Posted by Jeremy Thomerson <je...@wickettraining.com>.
see InjectorHolder.inject(this) - it's documented on the wiki about spring
injection
--
Jeremy Thomerson
http://www.wickettraining.com
On Sun, Mar 29, 2009 at 6:07 PM, fachhoch <fa...@gmail.com> wrote:
>
> to add my javascript into header section , i will use
> response.renderJavascript(CharSequence, id);
>
> my java script is really big lot of code and so i want to put the script
> into spring bean ,I tried injecting the javscript using
> @SpringBean(name="")
> , but this works only for pages and is not working for my pojo , this
> pojo
> is managed by my application so is there any way to set any spring bean
> into
> any pojo automatically ?
>
> < quote author="Jeremy Thomerson-5">
> Simple:
>
> If you're adding JS code from your Page.html file - put it in a
> <wicket:head><!-- your script tag here --></wicket:head> tag.
>
> If you're adding it from your Page.java file - do this:
>
> add(new AbstractBehavior() {
> @Override
> public void renderHead(IHeaderResponse response)
> {
> response.renderJavascript(javascript, id);
> }
> });
>
> See the javadocs for what that ID does.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
> On Fri, Mar 27, 2009 at 6:03 PM, fachhoch <fa...@gmail.com> wrote:
>
> >
> >
> > and my header section already has some java script code
> >
> >
> > <script type="text/javascript">
> > function jqCheckAll(){
> >
> $("INPUT[type='checkbox']").attr('checked',
> > $('#checkAllAuto').is(':checked'));
> > }
> > </script>
> >
> >
> >
> > <script type="text/javascript">
> > window.onload = setupFunc();
> > </script>
> >
> >
> >
> >
> > from my page I am adding JS file using response.render(), the problem is
> > wickets adds the script and css at the end of the my code in header
> > section
> > so all my java script functions defined will not work , is there a way to
> > add the js and css at the top of my code in header section ?
> >
> > for eaxmple this my html
> >
> > <head>
> > <script>
> > my java script code
> > </script>
> > </head>
> >
> > when page is rendered
> >
> > <head>
> > <script>
> > my java script code
> > </script>
> > <link rel="stylesheet" type="text/css"
> > href="../../***********.css.CSSPATH/pagemask.js" />
> >
> > </head>
> >
> > i want this
> >
> > <head>
> > <link rel="stylesheet" type="text/css"
> > href="../../***********.css.CSSPATH/pagemask.js" />
> > <script>
> > my java script code
> > </script>
> >
> >
> > </head>
> >
> >
> > how to get this ?
> >
> > --
> > View this message in context:
> >
> http://www.nabble.com/adding-css-and-js-to-header-tp22751518p22751518.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
> >
> >
>
>
>
> --
> View this message in context:
> http://www.nabble.com/adding-css-and-js-to-header-tp22751518p22773977.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: adding css and js to header
Posted by fachhoch <fa...@gmail.com>.
to add my javascript into header section , i will use
response.renderJavascript(CharSequence, id);
my java script is really big lot of code and so i want to put the script
into spring bean ,I tried injecting the javscript using @SpringBean(name="")
, but this works only for pages and is not working for my pojo , this pojo
is managed by my application so is there any way to set any spring bean into
any pojo automatically ?
< quote author="Jeremy Thomerson-5">
Simple:
If you're adding JS code from your Page.html file - put it in a
<wicket:head><!-- your script tag here --></wicket:head> tag.
If you're adding it from your Page.java file - do this:
add(new AbstractBehavior() {
@Override
public void renderHead(IHeaderResponse response)
{
response.renderJavascript(javascript, id);
}
});
See the javadocs for what that ID does.
--
Jeremy Thomerson
http://www.wickettraining.com
On Fri, Mar 27, 2009 at 6:03 PM, fachhoch <fa...@gmail.com> wrote:
>
>
> and my header section already has some java script code
>
>
> <script type="text/javascript">
> function jqCheckAll(){
> $("INPUT[type='checkbox']").attr('checked',
> $('#checkAllAuto').is(':checked'));
> }
> </script>
>
>
>
> <script type="text/javascript">
> window.onload = setupFunc();
> </script>
>
>
>
>
> from my page I am adding JS file using response.render(), the problem is
> wickets adds the script and css at the end of the my code in header
> section
> so all my java script functions defined will not work , is there a way to
> add the js and css at the top of my code in header section ?
>
> for eaxmple this my html
>
> <head>
> <script>
> my java script code
> </script>
> </head>
>
> when page is rendered
>
> <head>
> <script>
> my java script code
> </script>
> <link rel="stylesheet" type="text/css"
> href="../../***********.css.CSSPATH/pagemask.js" />
>
> </head>
>
> i want this
>
> <head>
> <link rel="stylesheet" type="text/css"
> href="../../***********.css.CSSPATH/pagemask.js" />
> <script>
> my java script code
> </script>
>
>
> </head>
>
>
> how to get this ?
>
> --
> View this message in context:
> http://www.nabble.com/adding-css-and-js-to-header-tp22751518p22751518.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
>
>
--
View this message in context: http://www.nabble.com/adding-css-and-js-to-header-tp22751518p22773977.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: adding css and js to header
Posted by Jeremy Thomerson <je...@wickettraining.com>.
Simple:
If you're adding JS code from your Page.html file - put it in a
<wicket:head><!-- your script tag here --></wicket:head> tag.
If you're adding it from your Page.java file - do this:
add(new AbstractBehavior() {
@Override
public void renderHead(IHeaderResponse response)
{
response.renderJavascript(javascript, id);
}
});
See the javadocs for what that ID does.
--
Jeremy Thomerson
http://www.wickettraining.com
On Fri, Mar 27, 2009 at 6:03 PM, fachhoch <fa...@gmail.com> wrote:
>
>
> and my header section already has some java script code
>
>
> <script type="text/javascript">
> function jqCheckAll(){
> $("INPUT[type='checkbox']").attr('checked',
> $('#checkAllAuto').is(':checked'));
> }
> </script>
>
>
>
> <script type="text/javascript">
> window.onload = setupFunc();
> </script>
>
>
>
>
> from my page I am adding JS file using response.render(), the problem is
> wickets adds the script and css at the end of the my code in header section
> so all my java script functions defined will not work , is there a way to
> add the js and css at the top of my code in header section ?
>
> for eaxmple this my html
>
> <head>
> <script>
> my java script code
> </script>
> </head>
>
> when page is rendered
>
> <head>
> <script>
> my java script code
> </script>
> <link rel="stylesheet" type="text/css"
> href="../../***********.css.CSSPATH/pagemask.js" />
>
> </head>
>
> i want this
>
> <head>
> <link rel="stylesheet" type="text/css"
> href="../../***********.css.CSSPATH/pagemask.js" />
> <script>
> my java script code
> </script>
>
>
> </head>
>
>
> how to get this ?
>
> --
> View this message in context:
> http://www.nabble.com/adding-css-and-js-to-header-tp22751518p22751518.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: adding css and js to header
Posted by fachhoch <fa...@gmail.com>.
I am a layman with java script so i just follow the examples , i have lot
of other java scrit which i call in head section and i cannot put them in
.js files , please tell me how to handle
Steve Swinsburg-2 wrote:
>
> Have you tried putting your js block in its own .js and including it
> after the other wicket includes? It doesn't look like it's dynamic so
> could be easily included this way
>
> cheers,
> Steve
>
>
>
>
> On 27/03/2009, at 11:03 PM, fachhoch wrote:
>
>>
>>
>> and my header section already has some java script code
>>
>>
>> <script type="text/javascript">
>> function jqCheckAll(){
>> $("INPUT[type='checkbox']").attr('checked',
>> $('#checkAllAuto').is(':checked'));
>> }
>> </script>
>>
>>
>>
>> <script type="text/javascript">
>> window.onload = setupFunc();
>> </script>
>>
>>
>>
>>
>> from my page I am adding JS file using response.render(), the
>> problem is
>> wickets adds the script and css at the end of the my code in header
>> section
>> so all my java script functions defined will not work , is there a
>> way to
>> add the js and css at the top of my code in header section ?
>>
>> for eaxmple this my html
>>
>> <head>
>> <script>
>> my java script code
>> </script>
>> </head>
>>
>> when page is rendered
>>
>> <head>
>> <script>
>> my java script code
>> </script>
>> <link rel="stylesheet" type="text/css"
>> href="../../***********.css.CSSPATH/pagemask.js" />
>>
>> </head>
>>
>> i want this
>>
>> <head>
>> <link rel="stylesheet" type="text/css"
>> href="../../***********.css.CSSPATH/pagemask.js" />
>> <script>
>> my java script code
>> </script>
>>
>>
>> </head>
>>
>>
>> how to get this ?
>>
>> --
>> View this message in context:
>> http://www.nabble.com/adding-css-and-js-to-header-tp22751518p22751518.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
>>
>
>
>
>
--
View this message in context: http://www.nabble.com/adding-css-and-js-to-header-tp22751518p22752255.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: adding css and js to header
Posted by Stephen Swinsburg <s....@lancaster.ac.uk>.
Have you tried putting your js block in its own .js and including it
after the other wicket includes? It doesn't look like it's dynamic so
could be easily included this way
cheers,
Steve
On 27/03/2009, at 11:03 PM, fachhoch wrote:
>
>
> and my header section already has some java script code
>
>
> <script type="text/javascript">
> function jqCheckAll(){
> $("INPUT[type='checkbox']").attr('checked',
> $('#checkAllAuto').is(':checked'));
> }
> </script>
>
>
>
> <script type="text/javascript">
> window.onload = setupFunc();
> </script>
>
>
>
>
> from my page I am adding JS file using response.render(), the
> problem is
> wickets adds the script and css at the end of the my code in header
> section
> so all my java script functions defined will not work , is there a
> way to
> add the js and css at the top of my code in header section ?
>
> for eaxmple this my html
>
> <head>
> <script>
> my java script code
> </script>
> </head>
>
> when page is rendered
>
> <head>
> <script>
> my java script code
> </script>
> <link rel="stylesheet" type="text/css"
> href="../../***********.css.CSSPATH/pagemask.js" />
>
> </head>
>
> i want this
>
> <head>
> <link rel="stylesheet" type="text/css"
> href="../../***********.css.CSSPATH/pagemask.js" />
> <script>
> my java script code
> </script>
>
>
> </head>
>
>
> how to get this ?
>
> --
> View this message in context: http://www.nabble.com/adding-css-and-js-to-header-tp22751518p22751518.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
>