当结构中有数组字段时,如何转义HTML?
对于单个显示页,此代码工作:
show.go:
err := ShowTmpl.ExecuteTemplate(w, "show.html", struct {
Title string
SafeBody template.HTML
}{
t.Title,
template.HTML(t.BodyHTML),
})
对于索引页:
index.go
type as struct {
Articles []*Article
}
var a as
// some
我从页面-1的“选择列表”字段中选择一个值,然后单击一个按钮打开一个模型页(第2页)。需要将select列表字段值从页-1传递到模型页,但该值不传递给模型页。有时,模型页(第2页)中的item字段显示null,有时显示先前选定的值。
PAGE-1->select List Item Field
->Button->Redirect to Model page no (PAGE-2)->Link Builder (p1_select_list_item = &p2_item.)
注:使用甲骨文版19.1版