【发布时间】:2018-02-01 07:33:55
【问题描述】:
我正在尝试使用表单操作从 jsp 调用 servlet,但是当我提交表单时,显示 404 错误。我正在使用动态 Web 模块 3.0 并使用新的 -> eclipse Oxygen 的新 servlet 选项创建了 servlet。
我习惯了
@WebServlet("/UserLogin")
public class UserLogin extends HttpServlet {
......
...
}
声明我的servlet。该 serverlet 位于包 databaseFiles 下。
jsp文件的代码在这里
在eclipse中我可以清楚的看到eclipse自动映射了servlet。
<form class="w3-container" method="get" action="UserLogin">
</form>
也用过
action="UserLogin"
action="/UserLogin"
action="/Exam/UserLogin"
这里的考试是我的项目名称。
【问题讨论】:
-
看不到您的 servlet 代码。但我知道您在 index.html 中的脚本代码不正确。如果不先通过 servlet,就无法调用请求对象...
标签: java eclipse jsp servlets http-status-code-404