将 jquery 移植到 java
我有一个jquery cod,我想将它移植到java。由于我不熟悉 java,是否有任何选项可以快速完成此任务
这是我的代码
ASDR.PostStore = function(ec, options) {
this.ec = ec;
this.target = options && options.target;
var self = this;
var _send = function(url, transaction, pre, post) {
$(transaction).trigger(pre);
$(self).trigger(pre, transaction);
$(self).trigger('sending', transaction);
$.ajax({
type : "POST",
url : url,
data : transaction.toString(),
dataType: "json",
success : function(data) {
ec.expand(data, true);//Always updateOnIntern
$(self).trigger('sent', data);
$(self).trigger(post, data);
$(transaction).trigger(post, data);
},
error : function(data){
console.log("Logging error", data);
}
});
};
this.get = function(transaction) {
var url = (this.target + "get");
_send(url, transaction, 'getting', 'gotten');
}
this.persist = function(transaction) {
var url = (this.target + "persist");
_send(url, transaction, 'persisting', 'persisted');
}
/**
* Always asynchronous.
*/
this.is_async = function(){
return true;
}
}
}
提前致谢
Renjith Raj
i have a jquery cod with me and i want to port it to java. Is there any options available to do this task quickly since i am not familiar with java
Here is my code
ASDR.PostStore = function(ec, options) {
this.ec = ec;
this.target = options && options.target;
var self = this;
var _send = function(url, transaction, pre, post) {
$(transaction).trigger(pre);
$(self).trigger(pre, transaction);
$(self).trigger('sending', transaction);
$.ajax({
type : "POST",
url : url,
data : transaction.toString(),
dataType: "json",
success : function(data) {
ec.expand(data, true);//Always updateOnIntern
$(self).trigger('sent', data);
$(self).trigger(post, data);
$(transaction).trigger(post, data);
},
error : function(data){
console.log("Logging error", data);
}
});
};
this.get = function(transaction) {
var url = (this.target + "get");
_send(url, transaction, 'getting', 'gotten');
}
this.persist = function(transaction) {
var url = (this.target + "persist");
_send(url, transaction, 'persisting', 'persisted');
}
/**
* Always asynchronous.
*/
this.is_async = function(){
return true;
}
}
}
Thanks in advance
Renjith Raj
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
jQuery 是
Javascript
,通常在客户端执行。 Java 是一种在服务器端执行的程序语言。您不能直接将 jQuery 转换为 Java。不过,您可以使用 GWT 等库,它将 Java 转换为 Javascript。还可以在服务器端静态呈现内容。如果您搜索JSP/JSTL,您会发现很多资源。
jQuery is
Javascript
, which is usually executed on the client side. Java is a program language which is executed on the server side. You cannot directly convert jQuery to Java.You can however use a library such as GWT which translates Java to Javascript. There is also the possibility to statically render content server side. If you search for JSP/JSTL you'll find many resources.