原freemarker配置的ftl读取路径是默认在classes下,
增加userConfiguration配置使其可以在web路径下读取ftl

1. package
2.   
3. import
4. import
5.   
6. import
7.   
8. import
9.   
10. import
11. import
12. import
13. import
14.   
15. import
16. import
17.   
18. /**
19.  * 将struts的freemarkerManager配置放置在spring容器中维护
20.  * @author Administrator
21.  *
22.  */
23. @Component("springConfigToFreemarkerManager")  
24. @Scope("prototype")  
25. public class SpringConfigToFreemarkerManager extends
26.       
27. private static final String SPRING_FREEMARKER_BEAN = "freemarkerConfig";  
28.   
29. private
30.       
31. @Override
32. protected
33. throws
34.         FreeMarkerConfigurer fmconfig = (FreeMarkerConfigurer) ApplicationBeanContext.getBean(SPRING_FREEMARKER_BEAN);  
35. try
36.             Configuration configuration =fmconfig.createConfiguration();  
37. true);  
38. return
39. catch
40.             e.printStackTrace();  
41.         }     
42. return super.createConfiguration(servletContext);  
43.     }     
44.   
45. protected Configuration createUserConfiguration(ServletContext servletContext) throws
46.         userConfiguration =createConfiguration(servletContext);  
47.           
48. "/");  
49.           
50. try
51. new
52. catch
53.             e.printStackTrace();  
54.         }  
55. return
56.     }  
57.   
58. public
59. if(userConfiguration==null){  
60. try
61.                 createUserConfiguration(servletContext);  
62. catch
63.                 e.printStackTrace();  
64.             }  
65.         }  
66. return
67.     }  
68. }


struts.properties文件中


struts.freemarker.manager.classname= net.esj.basic.plugins.freemarker.SpringConfigToFreemarkerManager