This is my struts.xml file. As you can see an action class and an interceptor are configured.
My question is that, the interceptor is being called, but not the action class.
(Where as in tutorials, I read that after interceptor is executed it calls the action class method)
Please see my code:
<struts>
<package name="test" extends="struts-default">
<interceptors>
<interceptor name="loginkiran" class="vaannila.MyLoginInterCeptor" />
</interceptors>
<action name="HelloWorld" class="vaannila.HelloWorld" method="kiran">
<interceptor-ref name="loginkiran" />
<result name="SUCCESS">/success.jsp</result>
</action>
</package>
</struts>
This is my Action class’s kiran method
public class HelloWorld {
public String kiran() {
System.out.println("Hi inside the Kiran Method");
return "SUCCESS";
}
}
========================
This is my Interceptor class
public class MyLoginInterCeptor implements Interceptor {
@Override
public String intercept(ActionInvocation invocation) throws Exception {
System.out.println("The server Port is"+str);
return invocation.invoke();
}
}
You haven’t defined the INPUT result. Define it within struts.xml and direct to a page with
tag and you’ll figure out what was going wrong. If that doesn’t work, try this