WebServlet annotation not recognized
|
|
|
WebServlet Annotation
Servlet 3.0 provides the
@WebServlet
annotation to define a servlet, obviating the need for configuration in
web.xml
. If you are using this annotation available in the Servlet Spec version 3.0 and your favorite application server is not mounting your Servlet as expected. You have probably a problem with the root declaration of your web.xml.
To indicate your Application server you expect to use the Servlet Specifications version 3.0 you should declare in your namespaces the web-app_3_0 xsd in version 3.0 as demonstrated in the following snippet.
So, the root declaration of your
web.xml
must look like this :
If you have any remark or questions feel free to put a comment.If you enjoyed this tutorial and want to promote it don't hesitate to click on