Home > FAQs > How can we access the HttpServletResponse |
You can obtain the request by asking the ActionContext or implementing ServletResponseAware. Implementing ServletResponseAware is preferred.
The response is available on the ActionContext instance, which is made available via ThreadLocal.
Preferred
servlet-config
Interceptor is included in the Action's stack.
servlet-config
.setServletResponse
method. You may wish to include a companion getServletResponse
method.getServletResponse
to obtain a reference to the response object.
@see
struts-default.xml