wood burning stoves 2.0*
The moose likes Servlets and the fly likes @WebServlet annotation is not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "@WebServlet annotation is not working" Watch "@WebServlet annotation is not working" New topic
Author

@WebServlet annotation is not working

suryakant kachhi
Greenhorn

Joined: Nov 23, 2012
Posts: 2
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

Joined: Mar 10, 2008
Posts: 1760
    
    7

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?


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
suryakant kachhi
Greenhorn

Joined: Nov 23, 2012
Posts: 2
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

Joined: Aug 31, 2012
Posts: 47

@WebServlet annotation is there since Servlet version 3.0...check your version as well...this might be the case
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: @WebServlet annotation is not working