English 中文(简体)
是否可就J2EE项目建立一个纯javascript框架?
原标题:is A pure javascript framework on J2EE projects possible?

多年来,我一直在吉卜赛现场工作,并撰写了所有美国退休人员协会的职能,这些职能从服务器边下载了一些数据,并在客户方面提供。

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.

任何人都知道这样一个框架,还是有可能自行发展一个框架? 什么利弊?

感谢。

问题回答

只可能写在服务器和客户方面操作的java书写代码。

Sure, drop J2EE and come join the node.js community

关于框架,第2号。 你可以在两者之间进行富有想象力的沟通。 I ve 看到的最好的是自动的PC,如nodeQuery。 服务器向客户发送了OMP指挥系统。

或者,当你能够写到

解决办法是利用在统一分类和服务器目标模型之间具有直接约束力的框架。 这使得仅仅在服务器方面撰写验证书变得非常容易:你只是在 Java中指明验证法。 几内亚宇宙航空研究开发机构自动向客户提供这一验证(在提交之前)。

如果你想到,密码的例子就非常少。 大多数验证案件需要更多的编码数据甚至更多的数据。 依靠地理数据库验证用户的地址;您是否将这一完整的数据库推向客户方? 否,你向服务器发送了该地址,并在实时向用户展示验证结果。

联合会非常正确地采用这种办法(RichFaces, ICEFaces...)





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签