There are various ways of writing server code that build on top of the basic Servlet classes. JSP and Freemarker let you embed bits of Java code, and other scripting inside your HTML pages. These are parsed and converted to Java Servlet programs that dynamically generate HTML with variable fields. These are automatically recompiled as needed.
With JSP all you have to do is drop the *.jsp files in a magic directory and away you go. With Servlets you must put the *.class files or *.war files in a magic directory, and register the servlets in a web.xml file that maps application name to servlet class among other things.
// imports used in Servlets import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletException;Sun does not provide the jars. You get them from your servlet womb vendor — his particular implementation of the interfaces. If you use Caucho Resin, it will automatically use its version of the classes and automatically recompile your java source as-needed. You have to read the womb docs. Often they make you copy the entire set of system jars to your own directory for use.
Sun does provide some
so you can compile without having a womb, but that is not very useful. You can’t execute the code. To run, you need a servlet womb.javax.servlet.Filter is an interface to allow a transaction to be processed in an assembly line. Each Filter does some of the work and passes on the input or output to the next filter in the chain, and decides on who is next.
this.getServletContext().log( "oops: database connection lost" );System.out. println and System. err. println may or may not work in any given womb.
![]() |
recommend book⇒Head First Servlets and JSP: Passing the Sun Certified Web Component Developer Exam | ||
| paperback | hardcover | ||
|---|---|---|---|
| ISBN13: | 978-0-596-00540-5 | 978-0-596-51668-0 | |
| ISBN10: | 0-596-00540-7 | 0-596-51668-1 | |
| publisher: | O’Reilly | ||
| published: | 2008-08-07 | ||
| by: | by Bryan Basham, Kathy Sierra, Bert Bates | ||
| A very complete book, partly because it aims to prepare you for the Sun exam. It is also a difficult book. | |||
![]() |
recommend book⇒Core Servlets and Java Server Pages | |
| paperback | ||
|---|---|---|
| ISBN13: | 978-0-13-089340-6 | |
| ISBN10: | 0-13-089340-4 | |
| publisher: | Prentice Hall | |
| published: | 2000-05-26 | |
| by: | Marty Hall | |
| Complete text of the book available on line in pdf format. | ||
![]() |
recommend book⇒Java Servlet Programming | |
| paperback | ||
|---|---|---|
| ISBN13: | 978-0-596-00040-0 | |
| ISBN10: | 0-596-00040-5 | |
| publisher: | O’Reilly | |
| published: | 2001-01-15 | |
| by: | Jason Hunter, William Crawford | |
| highly reccommended. | ||
![]() |
recommend book⇒Web Development with JavaServer Pages | |
| paperback | ||
|---|---|---|
| ISBN13: | 978-1-930110-12-0 | |
| ISBN10: | 1-930110-12-X | |
| publisher: | Manning Publications | |
| published: | 2001-09-15 | |
| by: | Duane K. Fields, Mark A. Kolb, Shawn Bayern | |
![]() |
recommend book⇒Inside Servlets: Server-Side Programming for the Java(TM) Platform (2nd Edition) | |
| paperback | ||
|---|---|---|
| ISBN13: | 978-0-201-70906-3 | |
| ISBN10: | 0-201-70906-6 | |
| publisher: | Addison-Wesley | |
| published: | 2001-05-14 | |
| by: | Dustin R. Callaway, Danny Coward | |
![]() |
recommend book⇒Developing Enterprise Java Applications with J2EE and UML | |
| paperback | ||
|---|---|---|
| ISBN13: | 978-0-201-73829-2 | |
| ISBN10: | 0-201-73829-5 | |
| publisher: | Addison-Wesley | |
| published: | 2001-10-27 | |
| by: | Khawar Zaman Ahmed, Cary E. Umrysh | |
![]() |
and suggestions to improve this page to Roedy Green : | ||
| Canadian Mind Products | |||
| mindprod.com IP:[65.110.21.43] | |||
| Your face IP:[38.103.63.58] | |||
| You are visitor number 22,436. | |||
| You can get a fresh copy of this page from: | or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror) | ||
| http://mindprod.com/jgloss/servlet.html | J:\mindprod\jgloss\servlet.html | ||