Reputation: 13
I'm using the Play Framework and I would like to have a page that returns a different view depending on a parameter. Is it possible? I would ideally like to set the template from the controller itself
Upvotes: 1
Views: 262
Reputation: 6436
You can do it two ways, either load a different partial in the controller corresponding view:
#{if _CONDITION_}#{include 'file.html' /}#{/if}
#{else}#{include 'other_file.html' /}#{/else}
Or render a different view in the controller:
if(_CONDITION_) render("file.html", var1, var2);
else render("other_file.html", var1, var2);
Upvotes: 2