asp+ 页面的文件和asp 一样,也是一个 文本的文件,但是他的后缀名称已经不再是 .asp 而是 .asp+
当客户端浏览器向 iis 发出.aspx 的文件请求后,iis 会 首先将.aspx文件编译成运行状态的ngws 类文件来运行,请注意,这个编译的过程只在第一次运行的时候发生,以后就直接以运行态的ngws 类运行了(和 .jsp 是不是很类似??--豆腐添加,原文没有)
一个 最简单 asp+ 文件可以通过将 一个 html 文件的后缀名称修改为.aspx 来生成!在下面的例子中我们将作一个这样的例子
运行的范例请看这里:
http://tutorial.superexpert.com/quickstart/aspplus/samples/webforms/intro/intro1.aspx
原代码如下:
<html>
<head>
<link rel="stylesheet"href="intro.css">
</head>
<body>
<center>
<form action="intro1.aspx" method="post">
<h3> name: <input id="name" type=text>
category: <select id="category" size=1>
<option>psychology</option>
<option>business</option>
<option>popular_comp</option>
</select>
<input type=submit value="lookup">
</form>
</center>
</body>
</html>
(豆腐添加:
有的人会说,这个例子太简单了或者说根本就不是一个例子,但是对于学习来说,最起码让我们可以更深入的了解一下 asp+ 的一些神秘的外表,下面我们将要讲解一个 带有<%%>标签的粒子)
asp+文件和asp文件是兼容的,在<%%>之间我们可以使用嵌套的html语言,下面就是一个很简单的 和 asp 文件完全兼容 asp+ 文件
<html>
<head>
<link rel="stylesheet"href="intro.css">
</head>
<body>
<center>
<form action="intro2.aspx" method="post">
<h3> name: <input id="name" type=text>
category: <select id="category" size=1>
<option>psychology</option>
<option>business</option>
<option>popular_comp</option>
</select>
<input type=submit value="lookup">
<p>
<% for i=0 to 7 %>
<font size="<%=i%>"> welcome to asp+ </font> <br>
<% next %>
</form>
</center>
</body>
</html>
这个例子的运行请看
http://tutorial.superexpert.com/quickstart/aspplus/samples/webforms/intro/intro2.aspx
(豆腐添加:上面这个例子演示了aspx文件和asp文件的完全兼容性,但是仅仅是这样,aspx不会成为一个新的热点,下面会简单介绍下aspx文件的一个新创的功能)
提示:和asp不同的是,在<%%>中包含的代码,是被编译执行的,而不是象asp 一样是脚本级的执行
asp+ 文件中的 <% %> 代码可以和 asp 一样动态的去修改 html 的输出显示使得 客户端的 内容有所改变
<%@ page language="vb" %>
<html>
<head>
<link rel="stylesheet"href="intro.css">
</head>
<body>
<center>
<form action="intro3.aspx">
<h3> name: <input name="name" type=text value="<%=request.querystring("name")%>">
category: <select name="category" size=1>
<%
dim i as integer
dim values(3) as string
values(0) = "psychology"
values(1) = "business"
values(2) = "popular_comp"
for i = 0 to values.length - 1
%>
<% if (request.querystring("category") = values(i)) %>
<option selected>
<% else %>
<option>
<% end if %>
<%=values(i)%>
</option>
<% next %>
</select>
<input type=submit name="lookup" value="lookup">
<p>
<% if (not request.querystring("lookup") = null) %>
hi <%=request.querystring("name") %>, you selected: <%=request.querystring("category") %>
<% end if %>
</form>
</center>
</body>
</html>
运行的例子在
http://tutorial.superexpert.com/quickstart/aspplus/samples/webforms/intro/intro4.aspx
asp+还有很多新的特点,我我会在合适的时间继续介绍的!
请大家继续支持我们!
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器