1. 程式人生 > >JSP/Servlet及相關技術詳解

JSP/Servlet及相關技術詳解

script return 指令 o-c rip title info turn expires

JSP聲明

技術分享

<%!聲明部分%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>歡迎</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">

<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

</head>
<%!
//聲明一個整數變量
public int count;

/*
定義一個方法
*/
public String info(){
return "hello";
}
%>
<body>
this is my test page !
<br>
<%=count++ %>
<%=info() %>

</body>
</html>

技術分享

輸出JSP表達式

<%=表達式%>

<%=count++ %>
<%=info() %>

替代out.println輸出語句,輸出表達式語法後不能有分號

JSP腳本

技術分享

JSP的3個編譯指令

技術分享

JSP腳本的9個內置對象

技術分享

JSP/Servlet及相關技術詳解