java - Delegate action without redirect in Play 1.2.x -
given play controller mycontroller
action myaction
, possible call action without triggering redirect? let's have controller:
public class mycontroller2 extends controller { public static void myaction2() throws exception { mycontroller.myaction(); //this cause redirect. } }
is possible call myaction
without triggering redirect. note using play 1.2.x , not play 2.x.
you can call myaction
, not have redirect. change access level of myaction
except public
. however, not able route myaction
directly more.
if still need myaction
routable in it's own right, suggest moving common functionality separate method/class , calling method myaction2
, myaction
, so:
public class application extends controller { public static void myaction() { commonactionstuff("myaction"); } public static void myaction2() { commonactionstuff("myaction2"); } protected static void commonactionstuff(string whocalledme) { // common functionality implemented here rendertext(whocalledme); } }
Comments
Post a Comment