ZimletJS: Difference between revisions

(AjxRpc or howto access a JSP)
mNo edit summary
Line 14: Line 14:


== AjxRpc or howto access a JSP ==
== AjxRpc or howto access a JSP ==
MainHelloView.prototype._updateHTML_JSP =  
MainHelloView.prototype._updateHTML_JSP =  
function(to, body) {
function(to, body) {
var url = this.helloWorldZimlet.getResource('hello_world.jsp');
var url = this.helloWorldZimlet.getResource('hello_world.jsp');
 
to = AjxStringUtil.urlEncode(to);
to = AjxStringUtil.urlEncode(to);
body = AjxStringUtil.urlEncode(body);
body = AjxStringUtil.urlEncode(body);
var reqParam = 'to=' + to + '&body=' + body;
var reqParam = 'to=' + to + '&body=' + body;
var reqHeader = {"Content-Type":"application/x-www-form-urlencoded"};
var reqHeader = {"Content-Type":"application/x-www-form-urlencoded"};
 
AjxRpc.invoke(reqParam, url, reqHeader, new AjxCallback(this, this._updateHTMLCallback));
AjxRpc.invoke(reqParam, url, reqHeader, new AjxCallback(this, this._updateHTMLCallback));
};
};
MainHelloView.prototype._updateHTMLCallback=
MainHelloView.prototype._updateHTMLCallback=
function(result) {
function(result) {
var r = result.text;
var r = result.text;
DBG.println(AjxDebug.DBG2, "result:" + r);
DBG.println(AjxDebug.DBG2, "result:" + r);
this.getHtmlElement().innerHTML = r;
this.getHtmlElement().innerHTML = r;
};
};





Revision as of 04:29, 30 September 2008

Rather allot needs to be writtenby those that understand the intents of the JS API


AjxDispatcher

appears to be a way for anyone to register a global function that can then be run 'by name'

ie.

../ZmCalendarApp.js:   AjxDispatcher.registerMethod("GetCalController", "CalendarCore", new AjxCallback(this, this.getCalController));
Tasks_all.js:           var cc = AjxDispatcher.run("GetCalController");


AjxCallback

AjxRpc or howto access a JSP

MainHelloView.prototype._updateHTML_JSP = 
function(to, body) {
	var url = this.helloWorldZimlet.getResource('hello_world.jsp');

	to = AjxStringUtil.urlEncode(to);
	body = AjxStringUtil.urlEncode(body);
	var reqParam = 'to=' + to + '&body=' + body;
	var reqHeader = {"Content-Type":"application/x-www-form-urlencoded"};

	AjxRpc.invoke(reqParam, url, reqHeader, new AjxCallback(this, this._updateHTMLCallback));
};
MainHelloView.prototype._updateHTMLCallback=
function(result) {
	var r = result.text;
	DBG.println(AjxDebug.DBG2, "result:" + r);
	this.getHtmlElement().innerHTML = r;
};


Verified Against: Date Created: 2008
Article ID: https://wiki.zimbra.com/index.php?title=ZimletJS Date Modified: 2008-09-30



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search