R
R
retr02017-05-16 12:14:54
Java
retr0, 2017-05-16 12:14:54

How to set up a servlet in Idea?

I just started to understand Java EE and ran into a banal problem - how to set up the project correctly. In the end, it worked out somehow. I decided to write my first servlet, but in web.xml I get links underlined in red " java.sun.com/xml/ns /javaee " and " java.sun.com/xml/ns/javaee/web-app_3_0.xsd ".

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0">

    <servlet>
        <servlet-name>mainServlet</servlet-name>
        <servlet-class>com.voron.servlets.mainServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>mainServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
</web-app>

31c094162a1148ceb3022f0eabc82427.png
Please suggest what is wrong, but it is better to direct it to a good resource or an article where everything is described in detail for beginners.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Cr2ed, 2017-05-16
@retr0

Your package in the project structure does not match what you brought in web.xml. In the servlets project , and in web.xml com.voron.servlets

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question