在JSP中访问javax.ws.rs.core.Response标头

问题描述 投票:0回答:1

在使用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的正确方法是什么?尝试过此方法,但它返回null:

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

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

谢谢

使用Jersey在JAX-RS资源中提供以下内容:import javax.ws.rs.core.Response; ... Map map = new HashMap (); map.put(“ myAttribute”,“ value”); ...

jsp jersey jax-rs
1个回答
0
投票

根据Jersey MVC documentation,您可以使用:

© www.soinside.com 2019 - 2024. All rights reserved.