Joe
Joe

Reputation: 7919

Eclipse jsp error in editor

I'm getting errors (on X lines) in a jsp file but it all seems to be right.

<%@ 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? Is it using ServletException or javax.servlet.http anywhere?

Upvotes: 3

Views: 1071

Answers (1)

Bhushan
Bhushan

Reputation: 6181

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

To do this follow the steps:

  1. Right click on the project.
  2. Click on build path -> Configure build path
  3. In libraries tab -> click Add external jars
  4. Select servlet-api.jar file

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

  1. Right Click on project
  2. Select Properties tab
  3. Select targeted runtime tab
  4. Check the server you are using

Upvotes: 3

Related Questions