Jsp&Servelet 學習筆記(2)
作者:Eve Cole
更新時間:2009-07-02 17:15:08
1.2第一個jsp程式介紹:
1. 開啟一個文字編輯器,或是一個jsp專用的文字編輯器能標示出一些語法的高亮。
2、 如果你寫一個jsp來處理http請求那麼。將會和編寫html檔案一樣。
3. 一個jsp檔案如果要包含一些Jsp指令(列如一個taglib)的話要在檔案開頭寫上< %@% >
4、 你可以在你需要的地方輸入一個普通的表單提交或使用者標籤。
5、 儲存檔案時以.jsp為副檔名進行儲存。在一個web應用程式中放在整個目錄的頂層。既放在
Web-info同級目錄下。
例 :
// 表示註解內容<%-- --%>
<%-- use the 'taglib' directive to make the JSTL 1.0 core tags available; use the uri " http://java.sun.com/jsp/jstl/core " for JSTL 1.1 --%>//使用c :out標籤http://www.downcodes.com/
<%@ taglib uri=" http://java.sun.com/jstl/core " prefix="c" %>
<%-- use the 'jsp:useBean' standard action to create the Date object; the object is set as an attribute in page scope --%>//在jsp中使用javabean指明其(id)物件和(java. util.Date)類別.
<jsp:useBean id="date" class="java.util.Date" /> <html><head><title>First JSP</title></head><body><h2>Here is today's date< /h2>//使用表達式輸出${data}
<c:out value="${date}" /> </body></html>
http://blog.csdn.net/bruceleey/archive/2007/02/07/1503844.aspx