This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Passing HTTP parameters to Ajax callback methods
Skip to end of metadata
Go to start of metadata

Passing HTTP Parameters To Ajax Callback Methods

The following example demonstrates capturing the window position and adding a URL parameter to the Ajax request (assumes "window.pos" exists):

	webPage.add(new AbstractAjaxTimerBehavior(duration) {
		private static final long serialVersionUID = 1L;

		/**
		 * {@inheritDoc}
		 */
		@Override
		public final CharSequence getCallbackUrl(final boolean onlyTargetActivePage) {
			return super.getCallbackUrl(onlyTargetActivePage)) + "&pos=" + window.pos;
		}

		/**
		 * {@inheritDoc}
		 */
		@Override
		protected final void onTimer(final AjaxRequestTarget target) {
			final String pos = getRequest().getParameter("pos");
			// process pos ...
		}
	});
  • No labels