Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Struts
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Struts
Getting request from ActionContext class
Mahendran Aiyappan
Ranch Hand
Posts: 102
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi guys,
I have a doubt on how to get the HttpServletRequest object from ActionContext object. I tried in the following way.But what I need to give in the get method argument which should be a key.
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionInvocation; import com.opensymphony.xwork2.interceptor.AbstractInterceptor; public class SessionInterceptor extends AbstractInterceptor { public String intercept(ActionInvocation invocation) throws Exception { ActionContext context = invocation.getInvocationContext (); HttpServletRequest request = (HttpServletRequest) context.get("?") return invocation.invoke(); } }
Please give me your comments
Paras Jain
Ranch Hand
Posts: 141
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I think
you should
be able to use getApplication() method of action context.
If that does not work the try this key
StrutsStatics.SERVLET_CONTEXT. probably it shud work
Paras Jain
SCJP 5.0
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
interceptor not working in struts 2
ActionInvocation.getAction() method
Dumb Interfaces Question
Get the exception object into Interceptor
Setting request parameter from interceptor and accessing in ActionClass
More...