簡體   English   中英

編輯器中的Eclipse jsp錯誤

[英]Eclipse jsp error in editor

我在jsp文件中遇到錯誤(在X行上),但這一切似乎都是正確的。

<%@ 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

會是什么呢? 它在任何地方都使用ServletException或javax.servlet.http嗎?

對於您的第一個錯誤( java.servlet.http can not be resolved to a type ),您需要將servlet-api.jar文件放在`classpath中:

為此,請按照以下步驟操作:

  1. 右鍵單擊該項目。
  2. 單擊構建路徑 - >配置構建路徑
  3. 在庫選項卡 - >單擊添加外部jar
  4. 選擇servlet-api.jar文件

對於您的第二個錯誤:( javax.servlet.ServletException can not be resolved ):

  1. 右鍵單擊項目
  2. 選擇Properties選項卡
  3. 選擇目標運行時標簽
  4. 檢查您正在使用的服務器

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM