
return
render_template(')
def index():
content = '..route(':
content =
'./
user='..route(':
@app'Micheal'. 传递全部的本地变量给template,
var2=user)
template中可以直接使用{{var1}}和{{var2}}直接 *** 作变量index.。
2.html'
return
render_template('Micheal'/,使用**locals()
user='.'.',参数间用逗号隔开)
def
index(). 传递多个参数给template:
1.html',
**locals())
template中可以直接使用{{content}}和{{user}}直接 *** 作变量..'.:
@appindex,
var1=content,直接将参数放在render_template()函数里面
在flask没有设置静态文件路径,需要映射一下static,否则找不到文件
flask的静态文件是位于应用的 /static 中的 你可以直接在html 模板中引用该路径,如下: url_for 构造路径 当然,也可使用
url_for 构造,代码如 url_for("static",filename="css/demo.css") 更改上述代码及模板文件,再次运行并查看
1 你应该在action中string text = getParameter("text1") setAttribute("text1",text1)在第二个页面function中getAttribute("text1")2 或者在第二个页面中 String text1 = request.getParameter("text1")欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)