struts2 和 freemarker 模板
我在我的网络应用程序上使用struts2,在一个jsp文件中,我使用“迭代器”以表单形式显示3个数组列表。
当我使用 tomcat 启动我的应用程序时,一切正常。但我想让它与 websphere6.1 一起使用,但是当我现在启动它时,页面需要 20-30 秒才能出现,而使用 tomcat 则不到 1 秒。
这是我的 websphere 控制台上的日志:
(freemarker.cache 81) 无法在缓存中找到模板,正在创建新模板; id=[模板/simple/form.ftl[fr_FR,UTF-8,已解析]]
在页面出现之前我已经有近 9000 行这样的行了。
我尝试使用 prop 创建一个文件“freemarker.properties”:
template_update_delay=60000
还尝试在 WEB-INF 上的源根目录中提取“template/simple”...什么都没有!
你有什么想法吗?
i use struts2 on my web app, in one jsp file i display 3 arraylist in a form using "iterator".
when i launch my app with tomcat everything works fine. but i would like to make it works with websphere6.1, but when i launch it now the page take 20-30 second to appears, with tomcat it was lass than 1 second.
here is the logs i have on my websphere console :
(freemarker.cache 81 ) Could not find template in cache, creating new one; id=[template/simple/form.ftl[fr_FR,UTF-8,parsed] ]
i have almost 9000 lines of this kind before page appears.
i tried to create a file "freemarker.properties" with prop :
template_update_delay=60000
also tried to extract the "template/simple" in my source root, on WEB-INF... nothing !
do you have any idea ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
模板文件夹应复制到
WEB_APP root
而不是WEB-INF
。我的建议:将模板文件夹重命名为
templates
以区别于默认值。参考Struts2的性能调优:
关闭日志记录和 devMode
确保关闭 Freemarker 日志记录(尤其是 Freemarker 生成大量的日志记录)。
尝试使用 Freemarker 等效项而不是使用 JSP 标记
应替换为${foo}
(类型转换除外),对 迭代器有很大的性能提升.The template folder should copy to
WEB_APP root
instead ofWEB-INF
.My suggestion : Rename the template folder to
templates
for distinguished from default.Refer to Performance tuning of Struts2 :
Turn off logging and devMode
Make sure to turn off Freemarker Logging (esp. Freemarker generates a LOT of logging).
Try to use the Freemarker equivalent rather than using the JSP tags
<s:property value="foo"/>
should be replaced by${foo}
(except for type conversion), great performancing enhancing for iterator.