Ben Ben - 2 months ago 9
Java Question

cannot resolve symbol 'servlet'

I got this big newbie question.
When i try the following; the 'servlet' turns red and indicates 'Cannot resolve symbol 'servlet'.

import javax.servlet.http.*;
import javax.servlet.ServletException;

I got apache tomcat running. I am a very big java newbie. Can anyone help me where to find a servlet library or something ? I googled but got no clear explanation of how to make this work.

This is the content of my web.xml file;

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns=""

This is my first webapp

<servlet-name>Hello world!</servlet-name>
<description>This is a hello world servlet</description>



EDIT: I use the IntelliJ IDEA IDE.
And I am using Maven.


The servlet jar needs to be in your build path.

If you are using maven you could do this :


Or use one of the providers listed here, Such as the below which is not dependent on a specific container :