我想在Eclipse中使用Servlet进行开发,但它说javax.servlet无法解析包.如何将javax.servlet包添加到Eclipse项目中?
这是关于在spring mvc app的jsp页面中访问资源的问题的后续问题 感谢@ kmb385我能够解决这个问题,但现在我在我的JSP文件中得到以下eclipse错误javax.servlet.jsp.JspException不能解决了一个类型和
javax.servlet.jsp.PageContext无法解析为类型
按照kmb385的建议,这是我的控制器:
@Controller
public class AdminController {
@RequestMapping("/")
protected ModelAndView handleRequestInternal(HttpServletRequest request,
HttpServletResponse response) throws Exception {
ModelAndView model = new ModelAndView("index");
model.addObject("msg", "hello world");
return model;
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的index.jsp页面以防万一:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<!-- <link type="text/css" rel="stylesheet" href="css/style.css"/> -->
<style type="text/css">
<%@include file="css/style.css" %>
</style>
<title>My Project - MainPage</title>
</head>
<body>
<h2 class="main_heading2">My Project - MainPage</h2>
<div …Run Code Online (Sandbox Code Playgroud)