在使用freemarker时遇到session取值报错问题。求大神看看

爱喝甜咖啡 2017-09-22 10:52:32
报错信息:
FreeMarker template error:
The following has evaluated to null or missing:
==> Session [in template "estudy/indexThree/indexArea/index-mainMenu.ftl" at line 9, column 6]

----
Tip: If the failing expression is known to be legally refer to something that's null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
- Failed at: #if Session["province_plat_form"]?? [in template "estudy/indexThree/indexArea/index-mainMenu.ftl" at line 9, column 1]
- Reached through: #include "/estudy/indexThree/indexAre... [in template "estudy/common/common-pages.ftl" in macro "headerIndexThree" at line 73, column 5]
- Reached through: @pages.headerIndexThree curIndex="\${... [in template "estudy/indexThree/estudyIndexThree.ftl" at line 21, column 9]
----

Java stack trace (for programmers):
----
freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...]


页面的显示:
<#if Session["province_plat_form"]??>
<a href="${request.contextPath}/estudy/selfCourse/selfCourseCenter.action" <#if curIndex?default('')==MOD_INDEX_SELF_COURSE>class="current"</#if>>自建课程</a>
<#else>
</#if>


FreeMarker settings:

#0 is for development only! Use higher value otherwise.
template_update_delay=0
locale=zh_CN
default_encoding=UTF-8
number_format=0.##
date_format=yyyy-MM-dd
template_exception_handler=ignore

版本号
freemarker-2.3.22.jar

程序用的是 spring struts2
...全文
217 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧