使用flask python呈现另一个模板并在get请求时发送jinja变量,您只需执行以下操作:
@app.route("/login", methods=["GET", "POST"])
def login():
# User reached route via POST (as by submitting a form via POST)
if request.method == "POST":
# Ensure username was submitted
username = request.form.get("username"):
password = request.form.get("password"):
# Redirect user to home page
return render_template("home.html", username=username)
# User reached route via GET
else:
return render_template("login.html")
使用tomcat servlet在java上的等价物是什么?
1条答案
按热度按时间neekobn81#
使用servlet需要两部分:配置文件(web.xml)和servlet代码。
将配置设置到web.xml中:
然后编写servlet代码:
}
请看这里的servlet介绍:https://www.baeldung.com/intro-to-servlets