aspose file tools
The moose likes Struts and the fly likes Set HTTP header value from struts action class Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply 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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Set HTTP header value from struts action class
 
Similar Threads
Problem while running a project using tiles in netbeans
cannot access struts datasource
How to receive json data in request
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.