|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
觉得J2EE好像有很多工具,比如servlet,jboss,tomcat,ejb什么的,可是微软的.NET怎么什么也没有啊?客户端|革新|无革新|页面常常在网上找林林总总的材料看,来办理某一具有针对性的成绩,但是终极发明仍是MSDN好,惋惜年夜部分没有汉化,并且实例型的材料并非良多,但不论怎样说MSDN仍是必要我们仔细进修的!
<%@PageLanguage="C#"AutoEventWireup="true"
CodeFile="ClientCallback.aspx.cs"Inherits="ClientCallback"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML
1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<scripttype="text/javascript">
functionLookUpStock()
{
varlb=document.forms[0].ListBox1;
varproduct=lb.options[lb.selectedIndex].text
CallServer(product,"");
}
functionReceiveServerData(rValue)
{
Results.innerText=rValue;
}
</script>
</head>
<body>
<formid="form1"runat="server">
<div>
<asp:ListBoxID="ListBox1"Runat="server"></asp:ListBox>
<br/>
<br/>
<button>LookUpStock</button>
<br/>
<br/>
Itemsinstock:<spanID="Results"></span>
<br/>
</div>
</form>
</body>
</html>
1usingSystem;
2usingSystem.Data;
3usingSystem.Configuration;
4usingSystem.Collections;
5usingSystem.Web;
6usingSystem.Web.Security;
7usingSystem.Web.UI;
8usingSystem.Web.UI.WebControls;
9usingSystem.Web.UI.WebControls.WebParts;
10usingSystem.Web.UI.HtmlControls;
11
12publicpartialclassClientCallback:System.Web.UI.Page,
13System.Web.UI.ICallbackEventHandler
14{
15protectedSystem.Collections.Specialized.ListDictionarycatalog;
16protectedvoidPage_Load(objectsender,EventArgse)
17{
18StringcbReference=
19Page.ClientScript.GetCallbackEventReference(this,
20"arg","ReceiveServerData","context");
21StringcallbackScript;
22callbackScript="functionCallServer(arg,context)"+
23"{"+cbReference+"};";
24Page.ClientScript.RegisterClientScriptBlock(this.GetType(),
25"CallServer",callbackScript,true);
26
27catalog=newSystem.Collections.Specialized.ListDictionary();
28catalog.Add("monitor",12);
29catalog.Add("laptop",10);
30catalog.Add("keyboard",23);
31catalog.Add("mouse",17);
32
33ListBox1.DataSource=catalog;
34ListBox1.DataTextField="key";
35ListBox1.DataBind();
36}
37
38publicStringRaiseCallbackEvent(StringeventArgument)
39{
40StringreturnValue;
41if(catalog[eventArgument]==null)
42{
43returnValue="-1";
44}
45else
46{
47returnValue=catalog[eventArgument].ToString();
48}
49returnreturnValue;
50}
51}
我认为,可以通过更加简单的首次编译,而增加第二次编译的负担,来提高java的运行效率。只是将java源代码进行简单的等价转换,而不假设编译成某种虚拟机器的目标格式,而由本地编译器针对性的二次编译。 |
|