共计 2960 个字符,预计需要花费 8 分钟才能阅读完成。
Active Server Pages
活动服务器页面
Active Server Pages (ASP) is a standard developed by Microsoft to serve Web pages with dynamic content. An ASP document has an “.asp” extension and uses embedded scripting to insert dynamic data into the page before it is sent to the user’s browser. The GoAhead WebServer supports an open scripting architecture where scripting engines can be selected at run time. Individual pages can use multiple scripting engines if required.
To create an ASP script field in an ASP document, use the <% and %> ASP delimiters. For example, the following JavaScript will output “Hello World” in place of the ASP-delimited field:
<h1>Today is <% write(“Hello World”); %></h1>
活动服务器页面(ASP)是由微软开发的网页与动态内容服务的标准。一个 ASP 文件有一个“ASP”扩展和使用嵌入式脚本插入到页面中的动态数据,然后再发送到用户的浏览器。GoAhead WebServer的脚本引擎可以选择在运行时支持一个开放的脚本架构。个人网页可以使用多个脚本引擎,如果需要的话。
要创建一个 ASP 文件中的 ASP 脚本,就得使用 <%and%> ASP 定界符。例如,下面在 ASP 分隔字段中的 JavaScript 将输出“Hello World”:
<H1> Today is <%write(“Hello World”);%> </ H1>
Scripting Execution
脚本执行
When a user’s browser requests an ASP document, the default URL handler determines if the page is an ASP document by examining the document’s file extension. An “.asp” extension indicates that ASP processing is required. The document is read from the file system or ROM store in a one-pass operation. Text before the ASP delimiters is copied directly to the requesting browser. If ASP delimiters are found, the text between the delimiters is passed to the relevant scripting engine for execution. The resulting text is immediately passed back to the browser, and the process continues until the end of the document. This may differ a little from the processing provided by other ASP implementations. Some systems buffer all ASP output and permit scripted iteration over HTML tags. This is not supported as it requires complete in-memory storage of the entire ASP document before returning to the browser.
当用户的浏览器请求一个 ASP 文件,如果页面是通过检查文件的文件扩展名的 ASP 文件,默认的 URL 处理程序做出决定。一个“ASP”扩展表明,ASP处理程序正在被需求。该文件使用一通操作从文件系统或光盘存储中被读取。之前的 ASP 定界符文本直接复制到请求浏览器。如果被发现,ASP定界符之间的分隔符的文本传递给相关的脚本引擎执行。产生的文字会立即传回给浏览器,这个过程一直继续,直到文件结束。有所不同一点可能来自从其他 ASP 实现所提供的处理。某些系统中所有的 ASP 输出缓冲,并允许 HTML 标签,脚本迭代。而这里是不支持的,因为在返回到浏览器之前,它需要整个 ASP 文件的完整的内存中的存储。
Scripting Engine Selection
脚本引擎选择
To specify the scripting engine, use the “language=” specifier at the beginning of the ASP script. The language selection is sticky, meaning the language will remain the default language until another “language=” keyword is encountered at the start of an ASP script later in the page. For example:
<% language=javascript write(“Query String: ” + QUERY_STRING) %>
<% write(“JavaScript is still the selected language”): %>
为了指定脚本引擎,必须在 ASP 脚本开始使用 ”language=”说明。语言选择是粘贴的,这意味着该语言将保持默认语言,直到在 ASP 脚本开始后遇到另一个语言关键。例如:
<% language=javascript write(“Query String: ” + QUERY_STRING) %>
<% write(“JavaScript is still the selected language”): %>
If no “language=” is specified, the default language is JavaScript. You should always specify the language in the <HEAD></HEAD> section of your page for good practice.
如果 ”language=” 没有被指定,则默认语言是 JavaScript。好的做法是你应该你选择的<HEAD></ HEAD> 页面中指定语言。
GoAhead 的详细介绍:请点这里
GoAhead 的下载地址:请点这里
相关阅读:
GoAhead 上实现文件上传到嵌入式 Web 服务器上 http://www.linuxidc.com/Linux/2011-10/45429.htm
GoAhead 2.5 嵌入式 Web 服务器移植到 ARM9 2440 + Linux 中 http://www.linuxidc.com/Linux/2011-09/43267.htm
GoAhead 移植到 uClinux 平台上 http://www.linuxidc.com/Linux/2011-01/31076.htm