On October 23rd, 2014, we updated our
By continuing to use LinkedIn’s SlideShare service, you agree to the revised terms, so please take a few minutes to review them.
Introducing Servlets Installing Tomcat Installing Eclipse Your first Java web application Your first Servlet Agenda
Static HTML is so boring! – Dynamic content with Servlets A Java program that runs on a server. Follows a standard specification. Standard way to register servlet. Current version 3.0 (JSR 315) We focus on 2.5 (JSR 154) as 3.0 is very new Server forwards incoming request – headers, form data to registered servlet based on URL. Servlet processes data, generates new data and passes back to the server which in turn forwards it to the browser What is a servlet?
In Action Servlet RDBMS Browser Servlet Server JVM
Efficient Uses threads not OS processes, one servlet instance Convenient High level utility functions Powerful Data processing, pooling, persistence Portable Runs on any OS where you get JVM Inexpensive Best in class open source servers to run servlets Advantages
Secure No hazards related to process management Popular Most popular use of Java technology Medium for large web apps of the scale of Google search Supported by Apache, IBM, Oracle, Jetty, Coucho ….. Runs on Windows, Unix, MacOS, VMS, IBM Mainframe OS Used for All kinds of applications – airline, hotels, banking, insurance ….. Advantages
Hands On Exercise
Java web server Servlet reference implementation http://tomcat.apache.org Tomcat 7 – Servlet 3 Tomcat 6 – Servlet 2.5 Download Install Run See the web admin console Shutdown Tomcat
Eclipse IDE (http://www.eclipse.org) Open Source and supported by all biggies in Java business Eclipse 3.5 - Galileo Based on plug-in and OSGi core Few essential plug-ins Install Eclipse Run Eclipse Shutdown Eclipse Eclipse IDE
Setup new Tomcat 6 server Start Server Stop Server Setup Tomcat on Eclipse
Create workspace Create web application using Eclipse The project structure in Eclipse Need for web.xml Configure Tomcat 6 in Eclipse What is deployed? – war file Structure and contents of a blown up war file Manual deployment on Tomcat Deploy using admin console First Web Application
Ah this web application does nothing Let us create the first servlet on Eclipse What has changed on the web.xml Deploy What changes in the exploded war? Lets send a request for our servlet Hurray it responds First servlet