A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Frameworks
»
Struts
Author
Configuring a Interceptor to a Struts Action class
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2234
I like...
posted
Oct 25, 2009 09:44:19
0
Hello ,
Please help me in configuring my single Interceptor to my Action class.
This is my Interceptor class
public class ActionTimer implements Interceptor { public String intercept(ActionInvocation next) throws Exception { long t1 = System.currentTimeMillis(); String s= next.invoke(); long t2 = System.currentTimeMillis(); System.out.println(t1); System.out.println(t2); return s; } }
This is inside my struts.xml file :
<struts> <action name="MyAction" class="mypack.Login"> <!-- Login is my Action class not specified here --> <result>/myjsp.jsp</result> </action> </struts>
Now please tell me how can i add this interceptor to My Struts Action class . ( I have written this but don't know further how to associate them )
Please help
<interceptors> <interceptor name="actiontimer" cass="interceptor.ActionTimer" /> </interceptors>
Save India From Corruption - Anna Hazare.
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
I like...
posted
Oct 25, 2009 10:40:51
0
I've asked you a half-dozen times to read the documentation. You refuse. Why? Being able to locate and understand answers *on your own* is a *critical* skill for any responsible developer.
http://struts.apache.org/2.1.8/docs/interceptor-configuration.html
I agree. Here's the link:
http://aspose.com/file-tools
subject: Configuring a Interceptor to a Struts Action class
Similar Threads
Struts2 Interceptor Error in struts.xml file
Needs Explanation
interceptor not working in struts 2
Need Help about Interceptors in Struts2
use of interceptor
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter