This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Struts and the fly likes Set HTTP header value from struts action class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Set HTTP header value from struts action class" Watch "Set HTTP header value from struts action class" New topic
Author

Set HTTP header value from struts action class

Sheelu sheelu
Greenhorn

Joined: Apr 28, 2011
Posts: 2
Hi

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,
Sheelu
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Set HTTP header value from struts action class
 
It's not a secret anymore!