1.在session中保存userId的值
request.getSession().setAttribute("userId",userId);
2.在页面使用freemarker表达式,如果userId的值是空就会报错,所以要先判断一下
<#if Session["userId"]?exists>
${Session["userId"]}
</#if>
1.在session中保存userId的值
request.getSession().setAttribute("userId",userId);
2.在页面使用freemarker表达式,如果userId的值是空就会报错,所以要先判断一下
<#if Session["userId"]?exists>
${Session["userId"]}
</#if>