Reputation: 1728
am using Eclipse's New->Servlet wizard thereby having auto-generated servlet and servlet-mapping entries ready for me. But when I select a servlet's java file and delete it, the corresponding entries in web.xml don't get deleted.
How do I do this?
Upvotes: 1
Views: 4384
Reputation: 1474
How about using Annotations? You don't have to take care of any configuration in web.xml for this.
package com.inventwheel.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class DeleteMe
*/
@WebServlet(description = "DeleteMe Servlet", urlPatterns = { "/DeleteMe" })
public class DeleteMe extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public DeleteMe() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
}
Upvotes: 0
Reputation: 19443
I would imagine just edit the web.xml
file and delete the entries. It's likely by design that they are not automatically deleted when you delete the servlet.
Upvotes: 2