当前页面: 开发资料首页 → J2EE 专题 → 菜鸟学jsp(二)
摘要:
1。<%@ page import="java.util.*" %>
2。<%!
private static int guestNum;
public void jspInit() {
...
}
public void jspDestroy() {
...
}
%>
3。<% out.write(request.getRequestURI());%>
4。<%= "hello" %>
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="java.io.*" %>
<%-- 这是注释的方法 --%>
<%//当然这样也是可以的%>
<%-- 2中的定义 --%>
<%!
private static int guestNum;
public void jspInit() {
guestNum = 0;
}
%>
<head>
hello
</head>
<body bgcolor="#00ffff">
<%-- 4中的方法 --%>
<%= "hello from:" %>
<%-- 3中的方法 --%>
<% out.write(request.getRequestURI());
guestNum ++;
%>
<%= "You are the " + guestNum + " guest!" %>
</form>
</body>