1.显示注释:在客户端显示一个注释.
<!-- this file displays the user login screen -->
2.隐藏注释 :写在JSP程序中,但不是发给客户
<%-- comment --%>
<%-- this comments will not be visible in the page source --%>
3.在JSP程序中声明合法的变量和方法
<%! int i = 0;%>
<%! int a,b,c;%>
<%!Circle a = new Circle(2.0);%>
4.包含一个符合JSP语法的表达式
<font color = "blue"><%= map.size() %></font>
<b><%= numguess.getHint() %></b>
5.包含一个有效的程序段.
<%
String name = null;
if(request.getParameter("name") == null)
{
%>
<%@ include file = "error.jsp" %>
<%
}else{
foo.setName(request.getParameter("name"));
if(foo.getName().equalsIgnoreCase("integra"))
name = "shoshana"
}
%>
6.Page 指令 :定义JSP文件中的全局属性.
<%@ page import = "java.lang.*,java.util.*" %>
<%@ page buffer = "5kb" autoFlush= "false" %>
<%@ page errorPage = "error.jsp"%>
7.Taglib 指令:定义一个标签库以及其自定义标签的前缀.
<%@ taglib uri = "http//www.jspcentral.com/tags" prefix = "public" %>
<public:loop>..................</public:loop>
8 <jsp:forward> :重定向一个HTML文件,JSP文件,或者是一个程序段.
<jsp:forward page = "/servlet/login" />
<jsp:forward page = "/servlet/login">
<jsp:param name = "username" value = "shoshana"/>
</jsp:forward>
9. <jsp:getProperty>:获取Bean的属性值,用于显示在页面中
<jsp:useBean id = "calendar" scope = "page" class = "employee.Calendar">
<h2>
Calendar of <jsp:getProperty name = "calendar" property = "username">
</h2>
10.<jsp:include>:包含一个静态或动态文件.
<jsp:include page = "scripts/login.jsp" />
<jsp:include page = "shoshana.html" />
<jsp:include page = "/index.jsp" />
<jsp:include page = "scripts/login.jsp">
<jsp:param name = "username" value = "shoshana">
</jsp:include>
11.<jsp:plugin>:执行一个applet或Bean,有可能的话还要下载一个Java插件用于执行它.
<jsp:plugin type = applet code = "Molecule.class" codebase = "/html">
<jsp:params>
<jsp:param name = "molecule" value = "shoshana" />
<p>unable to load applet</p>
</jsp:plugin>
12.<jsp:useBean>:创建一个Bean实例并指定它的名字和作用范围.
<jsp:useBean id = "cart" scope ="scope" class = "session.Cart" />
<jsp:setProperty name = "cart" property = "*" />
<jsp:useBean id = "checking" scope = "session" calss = "bank.checking">
<jsp:setProperty name = "checking" name = "bank" value = "shoshana" />
</jsp:useBean>