Java JSP Programming Tutorial
Java JSP Programming Tutorial
Chengyu Sun
California State University, Los Angeles
Java Server Page (JSP)
Why?
Its tedious to generate HTML using
println()
Separate presentation from processing
How?
Java code embedded in HTML documents
HelloJSP1.jsp
Look under
$TOMCAT_HOME/work/Catalina/localho
st/context_name
Eclipse Work Directory
$WORKSPACE/.metadata/.plugins/org.e
clipse.wst.server.core/tmp0
Or tmp1, tmp2, if you created multiple
server runtimes in Eclipse
Some Simple Observations
about the JSP/Servlets
HttpJspBase is a subclass of HttpServlet
_jspService() handles everything
replaces service() in HttpServlet
What happened to doGet(), doPost(), ...??
HTML text out.write(...)
JSP Components
HTML template text
Code elements of Java
Directives
Comments
Scripting elements
Beans
Expression language
Custom tag libraries
Directives
<%@ type attr=value ... %>
Three types of directives
page
include
taglib
Some Page Directives