【问题标题】:How to get the request header in Struts2 actions如何在 Struts2 操作中获取请求标头
【发布时间】:2015-02-19 04:59:45
【问题描述】:

如何在 Struts2 操作中获取请求标头我不能使用 request.header("") 方法,因为在 struts2 中请求只是一个 Map<String,Object> 因此此方法不可用。

【问题讨论】:

标签: struts2 request


【解决方案1】:

上网查了一下,我发现我需要我的action来实现ServletRequestAware,这让拦截器在你的action中推送HttpServletRequest。以后我可以使用相同的。谢谢大家的回复.. :)

public class CategoryAction implements ServletRequestAware{
    // Your code goes here...

}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-02-27
    • 2020-06-14
    • 2020-10-15
    • 2013-10-25
    • 2011-06-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多