0
操作:模型球衣JSP不工作
@GET
@Path("/test")
@Produces("text/html")
public Response test()
{
Map<String, Object> map = new HashMap<>();
map.put("name", "pedja1");
return Response.ok(new Viewable("/test", map)).build();
}
test.jsp的:
它在文件夾webapp/WEB-INF/jsp
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Test</title>
</head>
<body>
<h1>Hi ${model.name}!</h1>
</body>
</html>
我有這個在web.xml
:
<init-param>
<param-name>jersey.config.server.mvc.templateBasePath.jsp</param-name>
<param-value>/WEB-INF/jsp</param-value>
</init-param>
<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>org.glassfish.jersey.server.mvc.jsp.JspMvcFeature</param-value>
</init-param>
<init-param>
<param-name>jersey.config.servlet.filter.staticContentRegex</param-name>
<param-value>/(resources|(WEB-INF/jsp))/.*</param-value>
</init-param>
頁獲得加載但它打印Hi ${model.name}!
。
在[JSP 2.2 EL它關鍵字的可能的複製澤西島可視 - 在哪裏記錄?](http://stackoverflow.com/questions/17076829/jsp-2-2-el-it-keyword-in-jersey-viewable-where-is-it-documented) – AxelH