• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to use @WebServlet like web.xml element

 
Jenkin Zheng
Greenhorn
Posts: 12
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,guys.
I'm a beginner.My English is not good.


the servlet-mapping...



the servlet-mapping...

When I use javax.servlet.annotation.WebServlet. like this:



But one servlet can't duplicate annotation @WebServlet!
How can do it the same like in the web.xml!
Thanks!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34649
365
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can create a subclass of the servlet with no implementation and define it there. I'd prefer to keep both definitions in the web.xml. It is clearer to show how many instances of the servlet with different parameters there are.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic