Skip to content

Latest commit

 

History

History

servlet-example

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Servlet Example 1.0

In this example you can find basic Servlet configuration and usage. There is also JSP example, filtering requests, listener and showcase of configuration used by web.xml or by annotation, which allow to commit most of xml functionality.

How to install:

Main parts

Folder: src/main/java Package: org.examples.servlets

  • HomeController.java - controller which can server content to user depending on params
  • LoggingFilter.java - filter which record every request made to the server
  • Dispatcher.java - Default controller, which will grab aby not mapped request
  • Listener.java - Startup and shutdown listener, which can be used to made some pre-start and post-start operation
  • MainServlet.java - Servlet mapped by web.xml (it's same as HomeController only different approach)

Folder: src/main/webapp

  • js/main.js - javascript included into page
  • jsp/welcomePage.jsp - directly used JSP page which doesn't need any controller
  • index.jsp - default index
  • WEB-INF/web.xml - web.XML file for configuration of web application