struts2 and freemarker template

和自甴很熟 提交于 2019-12-13 01:50:51

问题


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 ??


回答1:


Could not find template in cache

The template folder should copy to WEB_APP root instead of WEB-INF.
My suggestion : Rename the template folder to templates for distinguished from default.

<constant name="struts.ui.templateDir" value="templates" />
<constant name="struts.ui.theme" value="simple" />

Refer to Performance tuning of Struts2 :

  1. Turn off logging and devMode
    Make sure to turn off Freemarker Logging (esp. Freemarker generates a LOT of logging).

  2. 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.



来源:https://stackoverflow.com/questions/5974164/struts2-and-freemarker-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!