单击以下jsp文件中的链接时出现404错误 这是我的jsp文件。
错误:/ list(也适用于/ new)
说明:原始服务器未找到目标资源的当前表示,或不愿意透露其存在。
<h1>Books Management</h1>
<h2>
<a href="/new">Add New Book</a>
<a href="/list">List All Books</a>
</h2>
这是我的servlet ...
@WebServlet("/")
public class Controller extends HttpServlet {
private static final long serialVersionUID = 1L;
private DataCrud bookDAO=new DataCrud();
protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
String action = request.getServletPath();
try {
switch (action) {
case "/new":
showNewForm(request, response);
break;
case "/insert":
insertBook(request, response);
break;
case "/delete":
deleteBook(request, response);
break;
case "/edit":
showEditForm(request, response);
break;
case "/update":
updateBook(request, response);
break;
default:
listBook(request, response);
break;
}
} catch (SQLException ex) {
throw new ServletException(ex);
}
}