golang:无法执行t.execute

时间:2017-07-31 07:51:01

标签: go

我正在尝试让Handler在每次从提交按钮获取数据时更新一行, 这是我的代码:

func RowHandler(res http.ResponseWriter, req *http.Request) {
    if req.Method != "POST" {
        http.ServeFile(res, req, "homepage.html")
        return
    }
    Person_id := req.FormValue("Person_id")

    stmt, err := db.Prepare("update Cityes set Status='right' where  Person_id=?")

    if err != nil {

        log.Print("error ", err)
    }
    _, err = stmt.Exec(&Person_id)

    t, err := template.ParseFiles("city_update.html") //hier i just want to show a text in html Page

    if err != nil {
        log.Fatal(err)
    }
    err = t.Execute(res, "/city_update")

}

1 个答案:

答案 0 :(得分:1)

此处代替

UnityEngine.AI.NavMeshTriangulation triangulatedNavMesh = UnityEngine.AI.NavMesh.CalculateTriangulation();

Mesh mesh = new Mesh();
mesh.name = "ExportedNavMesh";
mesh.vertices = triangulatedNavMesh.vertices;
mesh.triangles = triangulatedNavMesh.indices;

传递用于填充模板的数据作为发送辩论到err = t.Execute(res, "/city_update") 而不是字符串。 link to doc

例如。

Execute