The servlet name already exists solution

When creating a new servlet in eclipse, it always prompts The servlet name already exists.

1. Open the directory of the Javaweb project in eclipse, as shown in the figure below, find the web.xml file and open it

Or (project name---->Deployed Resources---->webapp---->WEB_INF---->web.xml)

 

2. Find the following code to delete, you can create a new one (LoginServlet is my duplicate servlet name, subject to the actual duplicate servlet name)

    <servlet>
		<servlet-name>LoginServlet</servlet-name>
		<display-name>LoginServlet</display-name>
		<description></description>
		<servlet-class>servlet.LoginServlet</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>LoginServlet</servlet-name>
		<url-pattern>/LoginServlet</url-pattern>
	</servlet-mapping>

 

Guess you like

Origin blog.csdn.net/dream_18/article/details/115221660