This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 1756
    
    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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: @WebServlet annotation is not working
 
Similar Threads
Why is web.xml not prior to annotation in conflict?
@Servlet
WAS7 for Developers & annotations
WebServlet annotation not working in Tomcat 7.0?
web.xml vs annotations