jsp脚本标记
page指令(属性:6个)
声明语言:<%@ page language="java" %>
引用包名::<%@ page import="java.util.*" %>
session设置:<%@ page session="true or false" %>
例子:
<%
if(session.getValue("name")==null)
session.putValue("name","123456");
else
session.putValue("name",session.getValue("name")+"1");%>
if(session.getValue("name")==null)
session.putValue("name","123456");
else
session.putValue("name",session.getValue("name")+"1");%>
指当前页面程序发生错误时,由errorPage指定的程序来处理写法:
<%@ page isErrorPage=" true" %>
<%@ page errorPage="errorPage.jsp" %>
<%@ page isErrorPage=" true" %>
<%@ page errorPage="errorPage.jsp" %>
contentType属性:
指定了MIME的类型和JSP文件的字符编码方式,它们都是最先传送给客户端。MIME类型有:text/plain、text/html(缺省类型)、text/html、image/gif、image/jpeg、image/jpeg
缺省的字符编码方式:ISO8859-1
指定了MIME的类型和JSP文件的字符编码方式,它们都是最先传送给客户端。MIME类型有:text/plain、text/html(缺省类型)、text/html、image/gif、image/jpeg、image/jpeg
缺省的字符编码方式:ISO8859-1
include指令
作用:是用来向当前页中插入一个静态文件的内容,这个文件可能是html文件、jsp文件或其它文本文件,格式如下:
<%@ include file="include.inc" %>
如:
native.jsp:
<body>native file start here.<br>
<%@ include file="include.inc" %>
native file end here.<br>
</body>
include.inc:include file start here.<br>
<%! String str="Here is include
<%@ include file="include.inc" %>
如:
native.jsp:
<body>native file start here.<br>
<%@ include file="include.inc" %>
native file end here.<br>
</body>
include.inc:include file start here.<br>
<%! String str="Here is include