Oops, I don’t know if you’re using a framework like Spring, but if you’re using pure Servlet you need to configure the project’s web.xml file:
Something like that:
<servlet>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>pacote.LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
// Classe servlet que responde por essa URL
<servlet-name>LoginServlet</servlet-name>
// URL que deseja mapear
<url-pattern>/login</url-pattern>
</servlet-mapping>
To create the file in Netbeans:
1. In the top menu click on File, choose New File.
2. On the screen that opens, select Web category, then select Standard Deployment Descriptor.
3. Click on Next.
4. Click Finish. The web.xml file will be created in the web/WEB-INF directory/.
Good evening, friend, and yes, I’m using pure Herbet. There is only one though, when I created the project I did not select to generate web.xml, and I am very lay in java, there is still how to generate it or need to copy from somewhere?
– Everton Neri
Everton Neri, Whereas you are using the Eclipse IDE: Right-click the project -> Java EE Tools -> Generate Deployment Descriptor Stub. Then it will be generated: /[NOME_PROJETO]/Webcontent/WEB-INF/web.xml
– pss1suporte
@pss1 support I’m actually using Netbeans, and for it I didn’t find the solution
– Everton Neri
@Everton Neri Includes in the above answer how to find this configuration within the Netbeans IDE. Hug.
– Kleber Silva