I know about the existence @Beforeand @After, but @Afteris executed after the template is rendered
Almost all my controllers extend my own class, and I want, unobtrusively, to be able to execute some code in my superclass, which checks some conditions and sets some flash / renderArgs after the code is executed in the subclass, but before rendering is done
any easy way to achieve this?
edit: here is the code snippet
class MyController extends Controller {
@After
static void checkStage() {
if (xyz) {
flash.put("stage", "bla");
}
}
}
all my controllers are expanding MyController, but since the code checkStageis called AFTER rendering is done, the stageflash attribute will be displayed next page rendering time
Actually, I would like to use flash.nowinstead flash.put, but since the code of the code @Afteris executed after rendering, it never appears
source
share