Reputation: 2148
We have completed 95% of our application. We want to add additional argument mode=1 to all templates URLS's in the browser. Is it possible by adding in one place like routing file,
The URL should be like be visible in the address bar.
Suppose, the original url is
http://localhost:9000/design/customersList
it needs to be add the mode=1, which will be like
http://localhost:9000/design/customersList?mode=1
Generally
http://localhost:9000/{module}/{action}?mode=1
Upvotes: 3
Views: 348
Reputation: 2148
I couldn't find any inbuild option in play to do that. So i added the mode in every template.
Upvotes: 0
Reputation: 5951
Do you want to access the configuration file from your views? If so, you can do it like this:
#{if play.Play.configuration.get("yourKey") == '1'}
... Do something ...
#{/if}
Otherwise, where do your "Additional arguments" come from?
Upvotes: 1
Reputation: 3833
Create a controller with a @Before method and in this method add your arg
@Before
public static void setUpTemplate() {
renderArgs.put("mode", "1");
}
In all your controllers, add this Controller as an interceptor with a @With annotation
Upvotes: 6