
如果你的数据在controller中已经存放在session当中了
假设你的前端用的是jsp, 那么只需要用JSTL就可以前端取出值了
每个jsp先引用库 即taglib
然后页面直接 ${sessionScopeusergetUserId()} 即可 希望采纳
springmvc的配置文件中对freemarker配置如下:
<bean
id="viewResolver"
class="orgspringframeworkwebservletviewfreemarkerFreeMarkerViewResolver">
<property
name="viewClass"
value="orgspringframeworkwebservletviewfreemarkerFreeMarkerView"
/>
<property name="suffix" value="html" />
<property
name="contentType" value="text/html;charset=utf-8" />
<property
name="exposeRequestAttributes" value="true" />
<property
name="exposeSessionAttributes" value="true" />
<property
name="exposeSpringMacroHelpers" value="true" />
<!--
此变量值为pageContextrequest, 页面使用方法:rccontextPath -->
<property
name="requestContextAttribute" value="rc" />
</bean>
是这样方式:
${Session["user"]}
~如果你认可我的回答,请及时点击采纳为满意回答按钮
~~手机提问的朋友在客户端右上角评价点满意即可。
~你的采纳是我前进的动力
~~O(∩_∩)O,记得好评和采纳,互相帮助,谢谢。
以上就是关于spring mvc联合查询存在session前台如何取值全部的内容,包括:spring mvc联合查询存在session前台如何取值、SpringMvc 整合Freemarker后,ftl页面怎么获取httpSession、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)