Eclipse jsp error in editor

I get errors (on X lines) in the jsp file, but it all seems to be correct.

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

    <form method="GET"
X           action="${pageContext.request.contextPath}/docreatetask">
        <table>
            <tr>
                <td>Task</td>
                <td><input name="task" type="text" /></td>
            </tr>
            <tr>
                <td>Description</td>
                <td><input name="description" type="textarea" /></td>
            </tr>
            <tr>
                <td>Deadline</td>
                <td><input name="description" type= /></td>
            </tr>
            <tr>
                <td></td>
X                   <td><input name="Create new task" type="submit" /></td>
            </tr>
        </table>
    </form>

</body>

**Error 1** javax.servlet.ServletException can not be resolved
**Error 2** javax.servlet.http can not be resolved

What could it be? Does ServletException or javax.servlet.http use somewhere?

+3
source share
1 answer

For your first error ( java.servlet.http can not be resolved to a type) you need to put the file servlet-api.jarin the `classpath:

To do this, follow these steps:

  • Right click on the project.
  • Click on the build path -> Configure build path
  • In the tab "Library" → "Add external banks"
  • Choose servlet-api.jarfile

For your second error: ( javax.servlet.ServletException can not be resolved):

  • Right click on the project
  • Select the Properties tab.
  • Select target runtime tab
  • , .
+3

All Articles