我正在尝试使用 httpunit servlet runner 测试以下 servlet 代码。除了包含 jstl 的 jsp 页面之外,这里一切都很好。
public class ListTenantServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final Logger log = Logger.getLogger(ListTenantServlet.class.getName());
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,
IOException {
doProcess(req, res);
}
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException,
IOException {
doProcess(req, res);
}
private void doProcess(HttpServletRequest req, HttpServletResponse res) throws ServletException,
IOException {
CompanyStatus companyStatus = TenantStatus.Paid;
req.setAttribute("companyStatus" companyStatus);
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/tenantList.jsp");
dispatcher.forward(req, res);
}
如果我尝试测试上面的代码,它会给出以下异常,但 servlet 在本地服务器中工作正常。
HTTP 请求错误:500 org.apache.jasper.JasperException:绝对 uri: http: //java.sun.com/jsp/jstl/core无法在 web.xml 或使用此应用程序部署的 jar 文件中解析 [ http://localhost/contextParam/tenantmgr/listTenant]
注意:我的 ListTenant.jsp 有 jstl 代码,如果我删除 jstl 代码,测试工作正常。
请帮助我使它工作。