浏览 9259 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2004-08-17
What I’m doing is try to compare with different Web Languages, techs … doing the same functionality and display page. I am using WebObjects (Apple) and java. I want to know what’s yours, like jsp,php,ASP….. THE TASK is one user input his/her name in text field, press Submit button and display the username and something 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 comes out and textfield set to nothing. The first time you look my code maybe confuses, but it’s definitely separate presentation page to java code. The wod file would be like transport pipe between them for passing object value(username and welcomeName) or calling method(sendName). Please give me your answer? 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2004-08-24
So many people read my topic, but why no reply. Not understand my words or not interested in this topic
|
|
返回顶楼 | |
发表时间:2004-09-02
Here is code from ASP.NET
<%@ Page language="c#" Codebehind="WebForm3.aspx.cs" AutoEventWireup="false" Inherits="TAccWebApplication1.WebForm3" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>WebForm3</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body> <form id="Form1" method="post" runat="server"> <P> <asp:TextBox id="txtUserName" runat="server"></asp:TextBox> <asp:Button id="btnSumbit" runat="server" Text="Submit"></asp:Button></P> <P> <asp:Label id="lblWelcome" runat="server"></asp:Label></P> </form> </body> </HTML> Code: using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace TAccWebApplication1 { /// <summary> /// Summary description for WebForm3. /// </summary> public class WebForm3 : System.Web.UI.Page { protected System.Web.UI.WebControls.Label lblWelcome; protected System.Web.UI.WebControls.TextBox txtUserName; protected System.Web.UI.WebControls.Button btnSumbit; private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.btnSumbit.Click += new System.EventHandler(this.btnSumbit_Click); this.Load += new System.EventHandler(this.Page_Load); } #endregion private void btnSumbit_Click(object sender, System.EventArgs e) { lblWelcome.Text=txtUserName.Text+" "+DateTime.Now.ToShortTimeString(); } } } |
|
返回顶楼 | |
发表时间:2004-09-05
好像少了Velocity
|
|
返回顶楼 | |
发表时间:2004-09-07
我用的是TAPESTRY!
|
|
返回顶楼 | |
发表时间:2004-09-09
please tell me how to write it in your favorite
language or tools. We can compare them. thanks |
|
返回顶楼 | |