Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Set HTTP header value from struts action class

Sheelu sheelu
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm trying to set the HTTP http header value from a struts action class. This is the code:
public ActionForward execute(ActionMapping aMapping, ActionForm aForm,
HttpServletRequest aRequest, HttpServletResponse aResponse)
throws Exception{
String userName = "test";
aResponse.addHeader("X-SCP-USERNAME", userName);
aResponse.setHeader("X-SCP-USERNAME", userName);

I verified this value being set by putting a breakpoint in the code, and I see this value is being set.
But, when I tried to access the value from another action class, I dont find this value being set. I used HttpFox to read the response from http header and I dont find the value there as well.
My target is to set a value in the http header so that a iframe in the page can read that value.

Thanks in advance,
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic