You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "raju.ch" <ra...@gmail.com> on 2011/12/08 05:25:54 UTC

How to add Javascript function in wicket 1.4 Page

Hi,
 I want to add Javascript which loads Javascript client side variables when
a page loads. It would call a Javascript function and pass in server-side
values.I want to add something like this 



Please note that it is not part of the header. Any help would greatly
appreciable.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-add-Javascript-function-in-wicket-1-4-Page-tp4171520p4171520.html
Sent from the Users forum 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: How to add Javascript function in wicket 1.4 Page

Posted by "raju.ch" <ra...@gmail.com>.
Hi Dan,
Thank you for your reply, I had resolved it by writing the below code
get("body").add(new AjaxEventBehavior("onload") {
			/**
					 * 
					 */
			private static final long serialVersionUID = 5189233126299039152L;

			protected void onEvent(AjaxRequestTarget target) {

				target
						.appendJavascript("alert(123)");
}

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-add-Javascript-function-in-wicket-1-4-Page-tp4171520p4171765.html
Sent from the Users forum 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: How to add Javascript function in wicket 1.4 Page

Posted by Dan Retzlaff <dr...@gmail.com>.
Hi, Raju. See if adding this to your Wicket component's constructor does
what you want:

add(new HeaderContributor(new IHeaderContributor() {
@Override
public void renderHead(IHeaderResponse response) {
response.renderOnDomReadyJavascript("alert('ready')");
}
}));

On Wed, Dec 7, 2011 at 8:25 PM, raju.ch <ra...@gmail.com> wrote:

> Hi,
>  I want to add Javascript which loads Javascript client side variables when
> a page loads. It would call a Javascript function and pass in server-side
> values.I want to add something like this
>
>
>
> Please note that it is not part of the header. Any help would greatly
> appreciable.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-add-Javascript-function-in-wicket-1-4-Page-tp4171520p4171520.html
> Sent from the Users forum 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
>
>