Tools: IDE (Eclipse for
JavaEE/NetBeans) + Application
Server (Apache Tomcat/GlassFish)
Core basic
Java web Java Servlet Class
server
technologies
Java Servlet Pages - JSP
Configure Apache Tomcat in Eclipse IDE
Configure Apache Tomcat in Eclipse IDE
Create a dynamic web project
Java Servlet Pages (JSP)
•JSPs are one of the core building blocks of Java web applications, allowing us to
combine HTML and Java seamlessly
•JSP lifecycle: http://www.tutorialspoint.com/jsp/jsp_life_cycle.htm
•We can embed Java code into JSP with scriptlet tags
<% Scriplets
java.util.Date today = new java.util.Date();
String mess = "Today is "+today;
%>
<%= mess %> Output
Or
<%
java.util.Date today = new java.util.Date();
String mess = "Today is "+today;
out.println(mess);
%>
Press CTRL+Space
For deployment
How to import Java classes into JSPs
How to retrieve parameters from the URL in
JSPs
Java Servlets
Java Servlets are programs that run on a Web
or Application server and act as a middle
layer between a request coming from a Web
browser or other HTTP client and databases
or applications on the HTTP server.
Servlet Lifecycle
1. Load Servlet Class.
2. Create Instance of Servlet.
3. Call the servlets init() method.
4. Call the servlets service() method.
5. Call the servlets destroy() method.
To get some URL parameters…
Work with scriplets and HTML
The include directive vs the include jsp tag
• Static include includes something into the page, before compiling and sending it to the browser
(directive)
• Dynamic include takes place at runtime (jsp tag)
Summary of JSP tags