📄 jsprm.htm
字号:
</table>
<p class="MsoNormal"><span style="font-size:13.5pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">编译器指引</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">JSP</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">的编译器指引是针对</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">JSP</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">引擎。它们并不会直接产生任何看得见的输出;相反的,它们是在告诉引擎如何处理其它的</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">JSP</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">网页。它们永远包含在</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">
<%@ ?%></span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">卷标里。两个主要的指引是</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">
page</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">与</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">include</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">。我们不会讨论</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">taglib</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">编译器指引但它可以在</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">JSP1.1</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">里用来建立自订卷标。</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;
font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">你几乎可以在你所有的</span><span lang="EN-US" style="font-size:10.0pt;
mso-bidi-font-size:12.0pt">JSP</span><span style="font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">网页最上面找到</span><span lang="EN-US" style="font-size:10.0pt;
mso-bidi-font-size:12.0pt">page</span><span style="font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">编译器指引。虽然这不是必须的,但它可以让你指定到哪里可以找到支持的</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">Java</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">类别这类的事:</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt"><%@
page import="java.util.Date" %></span><span style="font-size:10.0pt;
mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"">,</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt"> </span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;
font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">当发生</span><span lang="EN-US" style="font-size:10.0pt;
mso-bidi-font-size:12.0pt">Java</span><span style="font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">问题的事件时应该将讯息传送到哪里:</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt"><%@
page errorPage="errorPage.jsp" %></span><span style="font-size:
10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"">,</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt"> </span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;
font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">以及你是</span><span lang="EN-US" style="font-size:10.0pt;
mso-bidi-font-size:12.0pt">?</span><span style="font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">需要为使用者管理通话期的信息,可能存取多个网页</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">(</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">稍后在</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">JavaBeans</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">里会有更多通话期的讨论</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">):</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt"><%@
page session="true" %></span><span style="font-size:10.0pt;
mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"">。</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:
12.0pt"> include</span><span style="font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">编译器指引让你将你的内容分成几个可管理的组件,就像那些有表头或脚注的网页。所包含的网页可以是固定格式的</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">HTML</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">网页或者是</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">JSP</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">内容的网页</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">:</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt"><%@
include file="filename.jsp" %></span><span style="font-size:10.0pt;
mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"">。</span></p>
<p class="MsoNormal"><span style="font-size:13.5pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">宣告</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">JSP</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">宣告让你定义网页层的变量,来储存信息或定义支持的函式,让</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">JSP</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">网页的其余部分能够使用。如果你发现自己有太多的程序代码,你最好将它们放在不同的</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">Java</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">类别里。你可以在</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">
<%! ?%></span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">卷标里找到宣告。记住要在变量宣告的后面加上分号,就跟任何有效的</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">Java</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">叙述的形式一样</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">:
<%! int i=0; %></span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:
宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:"Times New Roman"">。</span></p>
<p class="MsoNormal"><span style="font-size:13.5pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">表达式</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">JSP</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">里有表达式,评估表达式的结果可以转换成字符串并且直接使用在输出网页上。</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">JSP</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">运算是属于</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">
<%= ?%> </span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">卷标里,并不包含分号,加引号字符串的无用部分。</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:
12.0pt"><%= i %></span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt"><%=
"Hello" %> </span><span style="font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">。</span></p>
<p class="MsoNormal"><span style="font-size:13.5pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">程序代码片段</span><span lang="EN-US" style="font-size:13.5pt">/</span><span style="font-size:13.5pt;
font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"">小型指令文件</span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">JSP</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">程序代码片段或小型指令文件是包含在</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt"><%
?%> </span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">卷标里。当网络服务器接受这段请求时,这段</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">Java</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">程序代码会执行。小型指令文件可以是原始的</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">HTML</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">或</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">XML</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">,其内部的程序代码片段可以让你建立有条件的执行程序代码,或者只是一些使用另一块程序代码的东西。举例来说,下列的程序代码结合了表达式与小型指令文件,在</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">H1</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">,</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">H2</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">,</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">H3</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">,以及</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">H4</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">卷标里显示字符串</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">"Hello"</span><span style="font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"">。小型指令文件不限于一行的原始程序代码</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt">
:</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:
12.0pt"><% for (int i=1; i<=4; i++) { %></span><span lang="EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;mso-bidi-font-size:12.0pt"><H<%=i%>>Hello</H<%=i%>></span><span lang="EN-US"><br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -