Title: Basic JSP
1Basic JSP
2JSP
JSP (Java Server Page) ???? JSP
??????????????????????????????? HTML, XML
?????????????????????? ??????????????? Tomcat
Apache ??? Java Compiler ???????? James Duncan
Davidson ?.?.2000 ????????????????? Servlet
?????????????? Byte Code ?????????????????????????
?? ??? JSP Source Code
????????? http//java.sun.com/products/jsp/faq.htm
l ????????? http//www.apl.jhu.edu/hall/java/Serv
let-Tutorial/
3?????????
- Servlet
- Servlet ????????????? Java ??????????????????????
???? Dynamic web ????????????????????? Web Server
?????????????????????????????????? Web browser
(HTTP client) ??? database ???? Application ??
HTTP Server
4????????? (???)
- JavaServer Pages / JSP
- ????????? JavaServer Pages (JSP) ?????????
Servlet ???????????? static HTML
????????????????????????? Servlet - JSP????????????? Servlet ????????????????????????
?????? - Jakarta Tomcat
- ???????????????????????????????????????
???????????? Servlet Engine ??? JSP Engine
????????????????? Servlet ??? JSP???
5How JSP works?
6JSP page translation and processing phases
Hello.jsp
helloServlet.java
helloServlet.class
7A Simple JSP Page
JSP tag
lt_at_ page importjava.text., java.util.gt
lthtmlgt
ltheadgtlttitlegtltDate Examplelt/titlegtlt/headgt
HTML
ltbodygt
Scriptlet
Today is ltemgtlttodaygtlt/emgt lt/bodygt lt/htmlgt
Example.jsp
- Static HTML/XML elements
- Dynamic scriptlets
- Special JSP elements
8JSP Processing- Translation Phase
request
response
JSP Page (.jsp)
JSP Translator
Text Buffer
Java Compiler
Servlet Source (.java)
Servlet Class (.class)
JVM
Servlet Container
Translation Phase
Request Processing Phase
9JSP Processing- Request Processing Phase
request
response
JSP Page (.jsp)
JSP Translator
Text Buffer
Java Compiler
Servlet Source (.java)
Servlet Class (.class)
JVM
Servlet Container
Translation Phase
Request Processing Phase