Home > FAQs > How can we access the HttpServletRequest |
You can obtain the request by asking the ActionContext or implementing ServletRequestAware. Implementing ServletRequestAware is preferred.
The request 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
.setServletRequest
method. You may wish to include a companion getServletRequest
method.getServletRequest
to obtain a reference to the request object.
@see
struts-default.xml