这是我的测试servlet;
public class EventListServlet extends javax.servlet.http.HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
process(request, response);
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
process(request, response);
}
private void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setAttribute("name", "test1");
request.getRequestDispatcher("index.jsp").forward(request, response);
}
}和测试jsp;
<html>
<body>
<h2>Hello World!</h2>
<p>${name}</p>
</body>
</html>输出为${name}
它应该写test1 :/这有什么问题?
发布于 2015-07-05 14:30:41
早期版本的JSP默认禁用EL。请参阅:http://docs.oracle.com/cd/E19316-01/819-3669/bnajh/index.html
要在此页面上启用EL计算,请尝试将以下指令放在JSP文件的顶部:
<%@page isELIgnored="false" %>https://stackoverflow.com/questions/31231354
复制相似问题