It cannot be done like this, I got the error: WicketMessage: Cannot modify component hierarchy after render phase has started (page version cant change then anymore)
On Sun, Mar 21, 2010 at 10:38 PM, Stefan Lindner <lind...@visionet.de>wrote: > Add them in the needed order > > response.renderJavascript("first", "firstUniqueID"); > response.renderJavascript("second", "firstUniqueID"); > > -----Ursprüngliche Nachricht----- > Von: Sigmar Muuga [mailto:meedi...@gmail.com] > Gesendet: Sonntag, 21. März 2010 21:36 > An: users@wicket.apache.org > Betreff: Re: Dynamic javascript generation > > My <script> tags are all in specific order, so how can I put this script > right after some certain script tag there? > > Sigmar > > On Sun, Mar 21, 2010 at 10:31 PM, Stefan Lindner <lind...@visionet.de > >wrote: > > > Ok, try this > > > > add( new AbstractBehavior() { > > @Override > > public void renderHead(IHeaderResponse response) { > > super.renderHead(response); > > response.renderJavascript("<some > dynamically > > generated JS>", "<uniqueID>"); > > } > > } > > ); > > > > Every time the component (to that the AbstractBehaivor is added) is > redrawn > > (eg. Initally or after an AjaxUpodate) the dynamically generated > javascript > > is renderedinto <HEAD>. > > If you want to make sure that it is not rendered twice from another > > component with thie AbstractBehavior, just add some "uniqueID" in the > > renderJavascript call. > > > > > > > > -----Ursprüngliche Nachricht----- > > Von: Sigmar Muuga [mailto:meedi...@gmail.com] > > Gesendet: Sonntag, 21. März 2010 21:22 > > An: users@wicket.apache.org > > Betreff: Re: Dynamic javascript generation > > > > I need to include this dynamic js in my header with <script> tag like > this > > in gmail: > > > > <script src="?view=page&name=browser&ver=zpwhtygjntrz > > <view-source: > > https://mail.google.com/mail/?view=page&name=browser&ver=zpwhtygjntrz > > >"></script> > > > > > > Some behaviour of that script depends on my session data on server side. > > I think that its not very complicated > > But I dont want to hardcode it to my html page, because urls and paths my > > changes. Dealing with resources provides more reliable configuration > etc.. > > > > Sigmar > > > > > > On Sun, Mar 21, 2010 at 9:19 PM, Stefan Lindner <lind...@visionet.de> > > wrote: > > > > > Generate some Javasript in response to e.g. a button klick? > > > Or generate JavaScript when the page is rendered? > > > > > > -----Ursprüngliche Nachricht----- > > > Von: Sigmar Muuga [mailto:meedi...@gmail.com] > > > Gesendet: Sonntag, 21. März 2010 19:53 > > > An: users@wicket.apache.org > > > Betreff: Dynamic javascript generation > > > > > > Hello, > > > I have to generate some javascript on the server side and then include > it > > > into my page. > > > Which is the best way to do this with current stable wicket release? > > > > > > A the moment I am thinking about extending WebResource.... > > > > > > Sigmar > > > > > >