func indexHandler(w http.ResponseWriter, r *http.Request) { if r.Method == "GET" { web.RenderHtml(w, "index.html", nil) } if r.Method == "POST" { userName := r.PostFormValue("user") if userName != "" { glog.Infof("User login, name=%s", userName) http.Redirect(w, r, "/hall/hall?user="******"index.html", nil) glog.Infof("Index post user is empty") } } }
func hallHandler(w http.ResponseWriter, r *http.Request) { type Param struct { User string } userName := r.FormValue("user") glog.Infof("User enter hall, name=%s", userName) web.RenderHtml(w, "hall.html", &Param{userName}) }