91-9990449935 0120-4256464 |
Struts 2 prepare interceptor exampleThe prepare interceptor calls prepre() method on the action if it implements Preparable interface. It calls prepare() method before the execute() method. To use the prepare interceptor, you need to implement Preparable interface in your action class and override its method prepare. It is found in the default stack bydefault. So you don't need to specify it explicitely. Parameters of prepare interceptorThere is only 1 parameter defined for prepare interceptor.
Example of prepare interceptorAction classThe action class must implement the Preparable interface and override its method prepare(). You can see output on the console, preparation logic is printed before the actual logic. OutputNow remove the entry of prepare interceptor from the struts.xml file, preparation logic will not be printed.
Next TopicStruts2 Modeldriven Interceptor Example
|