开发者

Java Playframework nested templates - argument passing

开发者 https://www.devze.com 2023-02-23 07:04 出处:网络
Can you pass specific, limited number of arguments to a included,nested template ? For example, in ParentTemplate.html, to do something like this (consider this as pseudocode :) :

Can you pass specific, limited number of arguments to a included,nested template ?

For example, in ParentTemplate.html, to do something like this (consider this as pseudocode :) :

#{include 'path/to/ChildTemplate.html' arg1: someArgInParentTemplate, arg2: someArgInParentTemplate2 /}

So that we can access only 2 separated variables for handling in child template named arg1 and arg2.

I personally do开发者_运维技巧n't like that all parent template variables are accessible in child template. Also, variable names in parent and in included child templates must be same - that's not good for templates modularity imo, or am I missing something here?

Simple and productive FW though :)


instead of using an include, create a tag (see this) and you will be able to limit the parameters it can access.

0

精彩评论

暂无评论...
验证码 换一张
取 消