Freemarker Servlet 和 Struts:访问模板中的 java 方法和变量
我想访问 Struts Web 应用程序的会话、应用程序和请求变量。 它告诉我 Session 的类型是“HttpSessionHashModel”,并且查找 API 我看到这个类有一个方法“isEmpty()”。所以我尝试了例如
<#assign a = Session.isEmpty()>
,但它告诉我不存在这样的元素“Session.isEmpty”。
有谁知道为什么它不起作用?
在会话中,我可以通过以下方式访问几个类 <#assign b = Session["classname"]>
(它告诉我 b
的类型为 freemarker.ext.beans.StringModel
),但我既无法调用类 StringModel
的方法,也无法访问存储在“classname”中的对象和方法。
希望有人能帮忙
I want to access the Session, Application and Request variables of a Struts web application.
It tells me Session is of type 'HttpSessionHashModel', and looking up the API I saw this class has a method 'isEmpty()'. so I tried for example
<#assign a = Session.isEmpty()>
but it tells me there is no such element 'Session.isEmpty'.
does anyone have an Idea why it is not working?
In Session there are several classes which I could access via<#assign b = Session["classname"]>
(it tells me b
is then of type freemarker.ext.beans.StringModel
), but I can neither call the methods of class StringModel
nor can I get to the objects and methods stored in 'classname'.
hope someone can help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
@s
宏:参考
Use the
@s
macro:References