【发布时间】:2015-12-02 11:25:22
【问题描述】:
我有一个 HTML 表单:
<form action="rest/ws/addNote" method="post">
我正在尝试发布到这个 servlet:
@WebServlet("/ws")
public class AddNote extends HttpServlet {
@POST
@Path("/addNote")
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// ...
}
}
但我不断得到
HTTP 状态 404 - 找不到相关资源:/ws/addNote of full path: http://localhost:8080/project/rest/ws/addNote
【问题讨论】:
-
你能给出你这个程序文件的路径吗?
-
Source包中是只创建了一个源码包,还是只有这个?
-
@Shar 您的代码中没有发布请求处理程序。我认为您正在将 servlet 与 jersy REST 混合使用