多年来,我一直在吉卜赛现场工作,并撰写了所有美国退休人员协会的职能,这些职能从服务器边下载了一些数据,并在客户方面提供。
Is it possible to only write javascript codes that run on both server-side and client-side.
象,如果我需要开发一个日志,我可以撰写这样一幅法典:
www.un.org/Depts/DGACM/index_spanish.htm EssAL CODE:
remote checkPassword;
function checkPassword(username, password){
if(existsRecord("select 1 from staff_t where user_name=? and password=?",username, password))
return true;
return false;
};
var main(){
var userName=$("username").val();
var password=$("password").val();
if(checkPassword(userName,password))
alert("Welcome, "+ user);
}else{
alert("sorry, wrong username or password.");
}
}
在上述法典中,javascript直接从达巴基数据库获取数据,是更清楚和更容易理解的。
While this code actually runs on production mode, it is separated by an engine to two pieces:
<<>SERVER-SIDE:
function checkPassword(username, password){
if(existsRecord("select 1 from staff_t where user_name=? and password=?",username, password))
return true;
return false;
};
<>CLIENT-SIDE:
var userName=$("username").val();
var password=$("password").val();
// checkPassword has been translated to an AJAX function.
if(checkPassword(userName,password))
alert("Welcome, "+ user);
}else{
alert("sorry, wrong username or password.");
}
这样一来,我们就能够为单一企业使用单一的法典,而不将其分为ava和 j。 该发动机将拆开该代码,并确定哪些部件在服务器上运行,而其他部分则在浏览器上运行。
我搜索了所有互联网,但找不到像能够提供数据库/EJB/WEBSERVICE的这种框架。
www.un.org/Depts/DGACM/index_spanish.htm 谷歌网络工具箱(GWT)使我们能够为浏览器申请撰写纯粹的JAVA代码,但对于我来说,这似乎只是一小cl。
Rhino is a javascript engine running on j2ee projects, but it doesn t provide any means to access both client-side data and server-side data.
任何人都知道这样一个框架,还是有可能自行发展一个框架? 什么利弊?
感谢。