You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Alex Objelean <al...@isdc.ro> on 2007/07/12 08:55:39 UTC

Re: ajax call from within client side javascript

Regarding making an ajax call from client side using the Igor's idea:

wouldn't it be great if getCallbackScript would allow to decorate somehow
callbackUrl with additional parameters? Or if getCallbackUrl method wouldn't
be final, the user could add them by overriding it. What do you think?


[CODE]
	protected CharSequence getCallbackScript(boolean recordPageVersion, boolean
onlyTargetActivePage)
	{
		return getCallbackScript("wicketAjaxGet('"
				+ getCallbackUrl(recordPageVersion, onlyTargetActivePage) + /*make it
possible to add additional parameters for ajax call*/ "'", null, null);
	}
[/CODE]



igor.vaynberg wrote:
> 
> so what exactly is the problem?
> 
> create callback interfaces for the operations you want to perform on a
> component
> implement them on a component
> in renderhead() write out a javascript function that uses
> urlfor(interface)
> and calls it using wicketajaxget
> 
> function foo(param1, param2) {
>    var url=<<interfaceurl>>;
>    url+="&param1="+param1+"&param2="+param2;
>    wicektAjaxGet(url); <== or use the prototype ajax engine or whatever
> }
> 
> then in your onevent handler you can get the params by doing
> Request.getParameter("param1");
> 
> what exactly is the big deal?
> 
> -Igor
> 
> 
> 
> On 7/11/06, Martijn Dashorst <ma...@gmail.com> wrote:
>>
>> Because it is built using Wicket already? Why not convert the whole
>> app to GWT? :-)
>>
>> I think this can be a good addition to Wicket, to be able to call into
>> a page using Ajax from within some client side javascript. There is no
>> need to do that in gwt, we're quite happy to write our own javascript
>> and wire it up in some way to our Wicket page.
>>
>> The point of discussion being the 'some way'.
>>
>> Martijn
>>
>> On 7/11/06, Igor Vaynberg <ig...@gmail.com> wrote:
>> > why not write this whole part as a gwt widget and connect it to wicket?
>> >
>> > -Igor
>> >
>> >
>> >
>> > On 7/11/06, Martijn Dashorst < martijn.dashorst@gmail.com> wrote:
>> > > In our case, not for specific libraries. We do use behavior.js,
>> > > prototype.js, scriptaculous.js, and dojo for effects and attaching
>> > > javascript behavior to specific components.
>> > >
>> > > In the case of Maurice, the problem is that we have key handlers that
>> > > capture cursor key presses, and move the focus from one field to the
>> > > next, in order to create an excel like feel. When a field recieves
>> > > focus, we want to retrieve some data for display in a tooltip like
>> > > popup, but only after half a second or so. Otherwise the server will
>> > > be flooded with requests coming in.
>> > >
>> > > Note that the number of fields is in the order of 30 * 6 * 4 = 720 or
>> > > so fields on one page. Add javascript to each input field, and you
>> > > have an explosion of markup to download. 800kb is not unusual. Even
>> on
>> > > high bandwidth connections 800kb takes a hit to download.
>> > >
>> > > Switching the visibility of elements in the client is also something
>> > > that can be done using Wicket Ajax, but is (much) more efficient when
>> > > done on the client. The same goes for copying values from one form
>> > > component to another, or setting context aware default values: for
>> > > instance when you say that someone is in born in the Netherlands, you
>> > > can be almost certain that he also has the dutch nationality.
>> > > Selecting the value in the dropdown box can be done on the server,
>> but
>> > > takes another serverside hit, whereas the same functionality can be
>> > > achieved using client side Javascript, where you don't have to go to
>> > > the server.
>> > >
>> > > Martijn
>> > >
>> > > On 7/11/06, Frank Bille Jensen < frank.bille@avaleo.net> wrote:
>> > > > On Tue, 2006-07-11 at 15:14 +0200, Martijn Dashorst wrote:
>> > > > > Not everything is a Wicket component. I
>> > > > > have such a usecase, but I am reluctant to publish it, as it is
>> > > > > security related. No reason to spill the beans about that.
>> > > >
>> > > > I'm not asking you to do anything like that :) My imagination is
>> just
>> > > > sometimes quite slow so I'm asking for some help there.
>> > > >
>> > > > But I agree there are usecases where it would be nice to have
>> easier
>> > > > access to an ajax request function.
>> > > >
>> > > > I haven't been in a situation where I needed to place logic on the
>> > > > client side. I like having it on the server side.
>> > > >
>> > > > Is it typically when you use third party javascript libraries?
>> > > >
>> > > > Frank
>> > > >
>> > > >
>> > > >
>> > > >
>> >
>> -------------------------------------------------------------------------
>> > > > Using Tomcat but need to do more? Need to support web services,
>> > security?
>> > > > Get stuff done quickly with pre-integrated technology to make your
>> job
>> > easier
>> > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache
>> > Geronimo
>> > > >
>> >
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>> > > > _______________________________________________
>> > > > Wicket-develop mailing list
>> > > > Wicket-develop@lists.sourceforge.net
>> > > >
>> > https://lists.sourceforge.net/lists/listinfo/wicket-develop
>> > > >
>> > >
>> > >
>> > > --
>> > > Download Wicket 1.2 now! Write Ajax applications without touching
>> > JavaScript!
>> > > -- http://wicketframework.org
>> > >
>> > >
>> > >
>> >
>> -------------------------------------------------------------------------
>> > > Using Tomcat but need to do more? Need to support web services,
>> security?
>> > > Get stuff done quickly with pre-integrated technology to make your
>> job
>> > easier
>> > > Download IBM WebSphere Application Server v.1.0.1 based on Apache
>> Geronimo
>> > >
>> >
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>> > > _______________________________________________
>> > > Wicket-develop mailing list
>> > > Wicket-develop@lists.sourceforge.net
>> > >
>> > https://lists.sourceforge.net/lists/listinfo/wicket-develop
>> > >
>> >
>> >
>> >
>> >
>> -------------------------------------------------------------------------
>> > Using Tomcat but need to do more? Need to support web services,
>> security?
>> > Get stuff done quickly with pre-integrated technology to make your job
>> > easier
>> > Download IBM WebSphere Application Server v.1.0.1 based on Apache
>> Geronimo
>> >
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>> >
>> >
>> > _______________________________________________
>> > Wicket-develop mailing list
>> > Wicket-develop@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/wicket-develop
>> >
>> >
>> >
>>
>>
>> --
>> Download Wicket 1.2 now! Write Ajax applications without touching
>> JavaScript!
>> -- http://wicketframework.org
>>
>>
>> -------------------------------------------------------------------------
>> Using Tomcat but need to do more? Need to support web services, security?
>> Get stuff done quickly with pre-integrated technology to make your job
>> easier
>> Download IBM WebSphere Application Server v.1.0.1 based on Apache
>> Geronimo
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>> _______________________________________________
>> Wicket-develop mailing list
>> Wicket-develop@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-develop
>>
> 
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> 
> _______________________________________________
> Wicket-develop mailing list
> Wicket-develop@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-develop
> 
> 

-- 
View this message in context: http://www.nabble.com/ajax-call-from-within-client-side-javascript-tf1923431.html#a11554656
Sent from the Wicket - Dev mailing list archive at Nabble.com.