• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@WebServlet annotation is not working

 
suryakant kachhi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello

can any buddy tell me that i have annotation with @WebServlet but is not working

@WebServlet(name="NewServlet",urlPatterns={"/NewServlet"})
public class NewServlet extends HttpServlet {

please tell me where is the problem???
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, and welcome to JavaRanch!

Assuming this isn't the entire Servlet class, it's hard to say what the problem is. Does the servlet "work" if you add it to the web.xml deployment descriptor insted of using annotations? Could you give use some more information about the servlet container / application server you're deploying to and what you're deployment structure looks like?
 
suryakant kachhi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes

actually its working when mapping is done in web.xml file but i want to do it with the annotation so where is i wrong
 
Ankit Dan
Ranch Hand
Posts: 47
Eclipse IDE Java MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@WebServlet annotation is there since Servlet version 3.0...check your version as well...this might be the case
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic