May i know how to init global variables in play framework? if can show in Japid is the best.
Appreciate your help.
Thanks
I found the solution. Below is my example:
I create a class and extends to Action.Simple
package common; import play.Play; import play.mvc.Action; import play.mvc.Http.Context; import play.mvc.Result; public class Init extends Action.Simple{ @Override public Result call(Context ctx) throws Throwable { ctx.args.put("resourcesurl", Play.application().configuration().getString("resources.url")); return delegate.call(ctx); } }
and this is my controller:
@With(Init.class) public class Museum extends JapidController{ public static Result nes(){ return renderJapid(); } }
at my html:
<img src="${Context.current().args.get("resourcesurl")}/resources/test.jpg"/>
hope this help others as well.
I found the solution. Below is my example:
I create a class and extends to Action.Simple
and this is my controller:
at my html:
hope this help others as well.