当前位置:网站首页>JSP Basics
JSP Basics
2022-06-21 18:50:00 【LvhaoIT】
JSP Basic knowledge
List of articles
- JSP Basic knowledge
- One 、JSP Specification introduce
- Two 、 The response object has drawbacks
- 3、 ... and 、JSP File advantage
- Four 、HTML File with the JSP File differences
- 5、 ... and 、Http Server calls JSP File steps :
- 6、 ... and 、Http The server 【 edit 】 And 【 compile 】JSP file location :
- 7、 ... and 、 stay JSP How to write in the document Java command
- 8、 ... and 、 How to integrate Servlet in doGet/doPost Method execution results to JSP File output
One 、JSP Specification introduce
From JAVAEE One of the specifications
JSP The specification sets out how to develop JSP Instead of the response object, the file writes the processing results to the development process of the response body
JSP The specification is formulated Http How the server should invoke Management JSP file
Two 、 The response object has drawbacks
It is suitable for writing processing results with less data to the response body
If the number of processing results is too large , Using response objects makes development more difficult
3、 ... and 、JSP File advantage
JSP Documents in the Internet communication process , Is a response object substitute .
Reduce the development workload of writing the processing results to the response body, and reduce the difficulty of maintaining the processing results
stay JSP File development , The processing results can be written directly to JSP Documents do not need to be handwritten out.print command , stay Http Server calls JSP When you file , according to JSP The specification requires that JSP All contents written by the file are written to the response body through the output stream
Four 、HTML File with the JSP File differences
As a resource, the file type is different
HTML The file is a static resource file , Its related commands need to be compiled and executed in the browser .
JSP This file is a dynamic resource file , Its related commands need to be compiled and executed on the server
The call form is different
If the browser accesses HTML file , here Http The server passes directly through an output stream
take HTML All contents of the file are written to the response body
If the browser accesses JSP file . here Http Server according to JSP Specification to operate JSP File editing ----> compile -----> call
5、 ... and 、Http Server calls JSP File steps :
1.Http Server will JSP The contents of the document 【 edit 】 For one Servlet Interface implementation class (.java)
2.Http Server will Servlet Interface implementation class 【 compile 】 by class file (.class)
3.Http The server is responsible for creating this class Instance object of , The instance object is Servlet Instance object
4.Http Server pass Servlet Instance object call _jspService Method , take jsp The contents of the file are written to the response body
6、 ... and 、Http The server 【 edit 】 And 【 compile 】JSP file location :
stay 【work】 See this evidence next
C:\Users[ Sign in windows System user role name ].IntelliJIdea2018.3\system\tomcat[ Web workspace ]\work\Catalina\localhost\【 Website alias 】\org\apache\jsp
7、 ... and 、 stay JSP How to write in the document Java command
1. Execution tag
<% %>
2. Command format
<% int a =10; %> Declare local variables
<% boolean flag = 30 >= 40; %> Java The expression in ( Mathematical expression , Relationship expression , Logical expression )
<%
if( Judge the condition ){
}else{
}
while(){
}
%> Write control statements
3. Command function
notice Tomcat Put the output in the tag 【 The value of the variable 】 Or in the output tag 【 The result of the expression operation 】 Write to the response body
8、 ... and 、 How to integrate Servlet in doGet/doPost Method execution results to JSP File output
JSP When a file is accessed , Not at all JSP The file is executing . It's the corresponding Servlet In execution
Customize Serlvet Interface implementation class and JSP Calling relationship between files , Equivalent to two Servlet Call relationship between
Customize Servelt Interface implementation class and JSP The files can be called through the redirection scheme or the request forwarding scheme. Considering the running efficiency , It is generally used 【 Request forwarding 】
Customize Servlet The interface implementation class can hand over the shared data to... By requesting the scope object JSP To output to the response body
边栏推荐
- Cookie与Session
- Day21Qt鼠标事件2021-11-01
- MarkDown初级语法一文精通,兼容MarkText
- C language__ attribute__ (packed) attribute (learn)
- VsCode自定义模板,用模板记笔记?!
- 如何通过 dba_hist_active_sess_history 分析数据库历史性能问题
- JDBC编程六步
- Collaborative filtering
- Book at the end of the article | new work by teacher Li Hang! A new upgrade of the classic machine learning work statistical learning methods
- Node输出方式
猜你喜欢

R语言 bug?报错?关于亚变量0、1 结局outcome,outcome变量经过factor和numeric过程,改变了原始内容?

JDBC 笔记

Canvas动态网状背景js特效

Day12QFile2021-09-27

缓存设计问题

Product graphic list description layout style

Book at the end of the article | new work by teacher Li Hang! A new upgrade of the classic machine learning work statistical learning methods

力扣160. 相交链表

Unity3D-后期处理 Post-process Volume Profile

互联网通信流程
随机推荐
Dao与实体类的封装
Canvas interactive color gradient JS special effect code
Deep Copy
新一代稳定性测试利器Fastbot
Typescript object type
[AISI software] wechat applet development quotation scheme template
Three.js 3d粒子动画js特效代码
How typescript is constructed
Node modular management
Day11QPainter2021-09-26
Show you how to distinguish several kinds of parallelism
微生物 个人笔记 taxonkit
Threejs aircraft Earth 3D scene animation
Some basic features of typescript
宏基因组 (个人笔记)
AWS device shadow usage
Canvas球体粒子变幻颜色js特效
Day18Qt信号与槽2021-10-29
Day13QMainWindow2021-09-28
Character processing of node