March 2019
Intermediate to advanced
336 pages
9h 9m
English
The Update function invokes the ExecuteTemplate method with writer and customer looked up by id. The ExecuteTemplate method renders the UPDATE template:
// Update - execute templatefunc Update(writer http.ResponseWriter, request *http.Request) { var customerId int var customerIdStr string customerIdStr = request.FormValue("id") fmt.Sscanf(customerIdStr, "%d", &customerId) var customer Customer customer = GetCustomerById(customerId) template_html.ExecuteTemplate(writer,"Update",customer)}
Read now
Unlock full access