Exemplo n.º 1
0
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")
		}
	}
}
Exemplo n.º 2
0
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})
}