# Programmatic Servlet/Filter Registration Example Project

Click here to start the ServletContainerInitializer example

## Description

This is an example MyEclipse web application project that demonstrates the various new features of the Servlet technology in Java EE 6 specification
Some key concepts covered in this example are:

- Servlet and Filter configuration using the @WebServlet and @WebFilter annotations respectively (without any web.xml configuration)
- Register a servlet and a filter programmatically at runtime
- Perform a simple filtering operation on the dynamically added servlet and filter

To simpify operation, this project is preconfigured to run as a standalone Web project with the 1-Click application launcher on the MyEclipse Server Sandbox, i.e., embedded Tomcat 7 servlet container that ships with MyEclipse. Alternatively, the EAR project containing this module may also be deployed to Java EE 6 and higher application servers.

## Requirements

- MyEclipse 2013 or later
- Java SE 6 or greater

## How to Run

Right-click on this project or the JEE6ServletExamplesEAR project and select either Debug As or Run As, then select "MyEclipse Server Application". Choose a server that you would like to test the application with; MyEclipse will automatically deploy the application to the chosen server and start the server. Note that the EAR can only be deployed to application servers like WebSphere, TomEE, Glassfish, JBoss, etc. This web module can be independently deployed to a servelet container like MyEclipse Tomcat.

## Related Links

- Overview of Servlet 3.0
- MyEclipse Application Server Tutorial
- MyEclipse Web Project Tutorial
- MyEclipse Web Fragment Project Tutorial
- MyEclipse WebSphere Application Server Tutorial

## Feedback

We hope you found this example project helpful. If you ran into any problems while working with the example project, please feel free to post to our support forums and let us know. Also if you have any suggestions for improvements, noticed something wrong or just wanted to ask questions we encourage you to post and let us know!