jsp頁面請求時, 背景報錯:
//-------------------------------------------頁面
Struts Problem Report
Struts has detected an unhandled exception:
Messages:
Template /WEB-INF/template/simple/form-close.ftl not found.
Template /WEB-INF/template/simple/form-close.ftl not found. - Class: freemarker.template.Configuration File: Configuration.java Method: getTemplate Line: 489 - freemarker/template/Configuration.java:489:-1
//-------------------------------------------背景
Stacktraces
org.apache.jasper.JasperException: Template /WEB-INF/template/simple/form-close.ftl not found. - Class: freemarker.template.Configuration File: Configuration.java Method: getTemplate Line: 489 - freemarker/template/Configuration.java:489:-1
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)
錯誤情況: 打開jsp頁面時, 背景報錯, 主要是 freemarker *.ftl not found .情況.
分析: 是 jsp中使用了struts标簽, 對其解析時,樣式無法找到錯誤. 但通過檢視樣式,在
struts2-core-2.1.8.1.jar中可以看到 form-close.ftl 樣式, 如下截圖:
![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLicmbw5CM2ATYkRDNyImNihTLykDM50iN5EzMtImZlZTLyUDO3gjYyMzLcFjMyQzLchzNwAzLcRnbl1GajFGd0F2LcRWYvxGc19CXt92YuUWelRXauwGZvw1LcpDc0RHaiojIsJye.png)
在classpath 中, 已确定加入了 此jar包.
在網上參考,一些資料, 仍沒有解決.
在國外一網站看到, 見 http://stackoverflow.com/questions/8900704/freemarker-looking-for-default-templates
主要指struts配置檔案,對ui.theme的設定.
### Standard UI theme
struts.ui.theme=xhtml
struts.ui.templateDir=template
打開本地的struts.xml配置檔案:
<constant name="struts.ui.theme" value="simple" />
<constant name="struts.ui.templateDir" value="WEB-INF/template" />
比較,将 templateDir的值 由WEB-INF/template 改為template.
重新開機server, ok!