html.jsp和srevlet的關係
1. jsp的作用:
* Servlet:
> 缺點:不適合設置html響應體,需要大量的riter()t("")
> 優點:動態資源,可以編程。
* html:
> 缺點:html是靜態頁面,不能包含動態信息
> 優點:不用爲輸出html標籤而發愁
* jsp(java server pages):
> 優點:在原有html的基礎上添加java腳本,構成jsp頁面。
2. jsp和Servlet的分工:
* JSP: > 作爲請求發起頁面,例如顯示錶單、超鏈接。
> 作爲請求結束頁面,例如顯示數據。
* Servlet:
> 作爲請求中處理數據的環節。
3. jsp的組成
* jsp = html + java腳本 + jsp標籤(指令)
* jsp中無需創建即可使用的對象一共有9個,被稱之爲9大內置對象。例如:request對象、out對象
* 3種java腳本:
> <%...%>:java代碼片段(常用),用於定義0~N條Java語句!方法內能寫什麼,它就可以放什麼!
> <%=...%>:java表達式,用於輸出(常用),用於輸出一條表達式(或變量)的.結果。riter()t( ... );這裏能放什麼,它就可以放什麼!
> <%!...%>:聲明,用來創建類的成員變量和成員方法(基本不用,但容易被考到),類體中可以放什麼(成員,方法。。),它就可以放什麼!
4. jsp原理(理解)
* jsp其實是一種特殊的Servlet
> 當jsp頁面第一次被訪問時,服務器會把jsp編譯成java文件(這個java其實是一個servlet類)
> 然後再把java編譯成s
> 然後創建該類對象
> 最後調用它的service()方法
> 第二次請求同一jsp時,直接調用service()方法。
* 在tomcat的work目錄下可以找到jsp對應的源代碼。
* 查看jsp對應java文件:
> java腳本
> html
5. jsp註釋
* <%-- ...="">:當服務器把jsp編譯成java文件時已經忽略了註釋部分!
:html註釋
相關文章
-
Jolie drops battle over perfume named Shilohy英語作文
自願退學申請書怎麼寫2022 篇1敬愛的院領導:你們好!我感謝學院給我這樣一個低分考生讀大學的機會,承蒙這1年來學院的培養和教導。在輕鬆愉快的學習氛圍下,我萌發了退學的想法,考慮再三,現正要將此想法付誅行動。後經過輔導 -
Hot spring Let Me Have A Rest爲題目的作文
題目:請以“Hot spring Let Me Have A Rest”爲題,寫一篇不少於60個單詞的作文。Hot spring Let Me Have A Rest溫泉讓我得到休息We took off our coats and ran quickly into the lemon spring. When I first put my f -
MS SQL Server Management Studio Express安裝圖文具體步驟
Microsoft sql server Management Studio Express (SSMSE) 是一種免費、易用的圖形管理工具,用於管理 SQL Server 2005 Express Edition 和具有高級服務的 SQL Server 2005 Express Edition。SSMSE 還可以管理任何版本 -
Covering the ears to steal the bell高中英語作文
很多人說會計競爭壓力大,面試難,如果自我介紹說得好,面試一定能拿下。下面本站小編爲你帶來3分鐘的會計自我介紹範文的內容,希望你們喜歡。關於3分鐘的會計自我介紹範文篇一:大家好,我叫XXX,今年27歲,畢業於XX學校, 我出生 -
Box Jellyfish Eyes Aim At The Trees美文欣賞
Box Jellyfish Eyes Aim At The TreesBox jellyfish have it over the rest of the jellyfish world—they have true eyes, featuring coeas, lenses and retinas. They have a more sophisticated nervous system t -
英語作文範文the sample of cover letter
the sample of cover letter1045 drake placeellisville. ma 01047march 27, 1987mr. adrian m. manteedirector of personnelblackwell manufacturing companyplattsburg, in 47401dear mr. mantee:in the march -
Help others is helping ourselves英語作文
Help others is helping ourselvesEveryone needs help and if we help others,we may also get something that is valuable like a beautiful star which shines in our we help our classmates,we feel friendshi -
Efforts Urged to Improve Womens Reproductive Health英語閱讀
Efforts Urged to Improve Women's Reproductive HealthParliamentarians from over 100 countries are being urged to take action in improving women's reproductive health ahead of the 2015 deadline -
高中英語作文:Smart tech makes life simpler
Most of us have been in this situation. You’re halfway to meeting your friends, then you suddenly ask yourself, Did I remember to tu the lights off? For those with smart homes, however, this wou -
大學生面臨許多壓力The Pressures on Collese Students英語作文
many college students say that they are facing so many pressures in their lives that they are on the go from moing till night. what, then, are the pressures on college students?there are generally thr