1
我打电话render()
有几个参数,其中第一个是String
说法,我作为一个参数:为什么在这里呈现不正确的模板?
公共静态无效动作(字符串URL){ ...
渲染( URL,...); }
我得到这个错误:
protected static void render(Object... args) {
String templateName = null;
if (args.length > 0 && args[0] instanceof String && LocalVariablesNamesTracer.getAllLocalVariableNames(args[0]).isEmpty()) {
// I'm getting into this branch
templateName = args[0].toString();
} else {
templateName = template();
}
renderTemplate(templateName, args);
}
什么if
努力做到:
The template http://the.contents.of/urlParameter does not exist.
现在,我通过render()
,在那里我看到这个片段的调试?为什么我会进入它 - 这是因为我没有使用局部变量url
?这是记录的吗?这里的推理是什么?
我使用的版本是1.2.x-c40cf37(这是1.2.4之后的某个地方)。
是的,我不知道这件事。它记录在任何地方吗? – ripper234 2012-01-09 10:18:12
古怪的约定。当然不会遵循最小的原则 - http://en.wikipedia.org/wiki/Principle_of_least_astonishment – ripper234 2012-01-09 10:21:17
我只在教程 - http://www.playframework.org/documentation/1.2找到它“记录”。 4/guide9 – Franz 2012-01-09 10:29:27