1

When displaying a webpage through the use of html templates in Google App Engine Go application, does the passed data and/or raw template ever leave the App Engine, or just the final html output? For example, if I have a class

type Foo struct{
    Public string
    Secret string
}

and a template that only uses {{.Public}} argument, does the {{.Secret}} argument ever leave the App? Similarly, if there is a template that displays some special data if the {{.Secret}} argument is present through the use of {{if .Secret}}...{{end}}, is there any way to access that part of the html in any way when the {{.Secret}} argument is not present?

4

1 回答 1

3

解析模板的是你的 Go 程序。这可以在多个 GAE 服务器实例上发生。假设离开GAE 意味着通过公共 Internet 上的 HTTP/S 连接发送,那么不 - 您发送的输出是已解析的 HTML 模板。

{{if .Secret}}如果该部分未包含在客户端收到的最终 HTML 中,则无法访问该部分。

但是,您可以做的是将模板及其关联的数据集编码为gobJSON超过您的客户端,并让您的客户端解析模板。

于 2012-09-14T11:00:57.343 回答