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 <fachh...@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-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to