java - Struts 2 interceptor that runs after the page executes? -


i'm using struts 2. using interceptor, create database connection @ start of each page execution.

so example, if user goes "myaction.do", create database connection , call myaction.do method.

what i'm looking interceptor or other way automatically call method after page execution, close database connection.

is possible?

in interceptor can write pre processing , post processing logics.

pre processing logic execute before action executes , post processing logic executes after action executes.

struts2 provides powerful mechanism of controlling request using interceptors. interceptors responsible of request processing. invoked controller before , after invoking action, sits between controller , action. interceptors performs tasks such logging, validation, file upload, double-submit guard etc.

whatever write after invocation.invoke(); execute after executes action

see here example


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -