Dibyendu
Dibyendu

Reputation: 51

How to get the request header in Struts2 actions

How can I get the request header in Struts2 actions I can not use request.header("") method because in struts2 request is just a Map<String,Object> thus this method is not available.

Upvotes: 0

Views: 2282

Answers (1)

Dibyendu
Dibyendu

Reputation: 51

After checking in the internet, I found that I need my action to implement ServletRequestAware, which lets an interceptor to push the HttpServletRequest in your action. later I can use the same. Thanx all for replying .. :)

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

}

Upvotes: 2

Related Questions