ITPUB??ì3
12月微软Hyper-V虚拟化沙龙主题征集
ITPUB论坛 » WEB程序开发 » Web develop language compare

新一届的微软MVP评选已经开始,欢迎各位推荐!

标题: Web develop language compare
离线 speedooo
中级会员



精华贴数 0
个人空间 0
技术积分 868 (2191)
社区积分 7 (13013)
注册日期 2003-5-1
论坛徽章:0
      
      

发表于 2004-8-5 12:02 
Web develop language compare

What I’m doing is try to compare with different Web Languages, techs … to do the same functionality and display page. I am using WebObjects (Apple) and java. I want to know what’s yours, like jsp,phpASP…..

THE TASK is one user input his/her name in text field, press Submit button and display the username and some else details you wanted, like timestamp from my example.


In My instance, I create one component including example.html, example.wod and example.java, could have other example.woo and example.api but not related with this task.

example.html
<HTML>
<HEAD>
        <META NAME="generator" CONTENT="WebObjects 5">
    <TITLE>Compare Site</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<center>

<WEBOBJECT NAME=MyForm>
User Name:<WEBOBJECT NAME=NameInput></WEBOBJECT>
<WEBOBJECT NAME=SubmitBtn></WEBOBJECT>
<hr>
<WEBOBJECT NAME=DisplayControl>
Welcome User <WEBOBJECT Name=NameOutput></WEBOBJECT>!
</WEBOBJECT NAME=DisplayControl>

</WEBOBJECT NAME=MyForm >
</center>       
</BODY>
</HTML>


example.wod
MyForm:WOForm{
  multipleSubmit = YES;
}

NameInput:WOTextField {
        value = userName;
}
SubmitBtn:WOSubmitButton {
action = sendName;
value="Submit";
}
DisplayControl:WOConditional{
        condition=display;
}
NameOutput:WOString {
        value= welcomeName;
}


Example.java
import com.webobjects.foundation.*;
import com.webobjects.appserver.*;
import com.webobjects.eocontrol.*;
import com.webobjects.eoaccess.*;

public class Example extends WOComponent {

    String userName, welcomeName;
    boolean display;
   
    public Main(WOContext context) {
        super(context);
        display=false;
    }

    public WOComponent sendName(){
        display=true;
        welcomeName= userName+" "+new NSTimestamp();
        userName="";
        return this.context().page();
    }
}

The initial page is only user name, textfield and submit button. When user input name and press button, the details will come out and textfield set to nothing.

The first time you look my code maybe confuses, but it’s definitely separate presentation page and java code. The wod file would be like transport pipe for passing object value(username and welcomeName) or calling method(sendName) in the between  of html and java code.


只看该作者    顶部
离线 speedooo
中级会员



精华贴数 0
个人空间 0
技术积分 868 (2191)
社区积分 7 (13013)
注册日期 2003-5-1
论坛徽章:0
      
      

发表于 2004-8-8 07:05 
No one intrested in this comparison???


只看该作者    顶部
 
    

相关内容


CopyRight 1999-2006 itpub.net All Right Reserved.
北京皓辰广域网络信息技术有限公司. 版权所有
E-mail:Webmaster@itpub.net
京ICP证:010037号 联系我们 法律顾问