wood burning stoves*
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 Murach's Java Servlets and JSP this week in the Servlets 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
 
Similar Threads
How to receive json data in request
Problem while running a project using tiles in netbeans
can't find this error .i got this error in strut
Struts2 Issue with localization: Messages not picked up from properties file for forward actions.
cannot access struts datasource