在 JSP 中访问 javax.ws.rs.core.Response header

Accessing javax.ws.rs.core.Response header in a JSP

在使用 Jersey 的 JAX-RS 资源中给出以下内容:

import javax.ws.rs.core.Response;
...
Map<String, String> map = new HashMap<String, String>();
map.put("myAttribute", "value");
return Response.ok(new Viewable("myJsp.jsp", map))
    .build();

从 jsp 访问 myAttribute 的正确方法是什么? 试过这个,但它 returns null:

console.log("<%= response.getHeader("myAttribute") %>");

请注意,JSP 页面包含在使用 <jsp:include>.

的 parent 页面中

谢谢

根据 Jersey MVC documentation,您可以通过以下方式访问它:

console.log("${model.myAttribute}");

console.log("${it.myAttribute}");