熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java核心技術 >> 正文

freemaker的標記語法

2022-06-13   來源: Java核心技術 

  借Struts核心jar包下的Filter包的errorftl文件來學習一下freemaker的標記語法

  該ftl模板(errorftl)用於指示開發者Struts頁面請求出錯後指定轉向該模板所生成的html靜態頁面

  <#

  /*

  * $Id: errorftl ::Z musachy $

  *

  * Licensed to the Apache Software Foundation (ASF) under one

  * or more contributor license agreements  See the NOTICE file

  * distributed with this work for additional information

  * regarding copyright ownership  The ASF licenses this file

  * to you under the Apache License Version (the

  * License you may not use this file except in compliance

  * with the License  You may obtain a copy of the License at

  *

  * 

  *

  * Unless required by applicable law or agreed to in writing

  * software distributed under the License is distributed on an

  * AS IS BASIS WITHOUT WARRANTIES OR CONDITIONS OF ANY

  * KIND either express or implied  See the License for the

  * specific language governing permissions and limitations

  * under the License

  */

  >

  <html>

  <head>

  <title>Struts Problem Report</title>

  <style>

  pre {

  margin: ;

  padding: ;

  }

  </style>

  </head>

  <body>

  <h>Struts Problem Report</h>

  <p>

  Struts has detected an unhandled exception:

  </p>

  <#assign msgs = [] />

  <#list chain as ex>

  <#if ssage??>

  <#assign msgs = [ssage] + msgs/>

  </#if>

  </#list>

  <#assign rootex = exception/>

  <#list chain as ex>

  <#if (exlocation?? && (exlocation != unknown))>

  <#assign rootloc = exlocation/>

  <#assign rootex = ex/>

  <#else>

  <#assign tmploc = locatorgetLocation(ex) />

  <#if (tmploc != unknown)>

  <#assign rootloc = tmploc/>

  <#assign rootex = ex/>

  </#if>

  </#if>

  </#list>

  <div id=exceptioninfo>

  <table>

  <tr>

  <td><strong>Messages</strong>:</td>

  <td>

  <#if (msgs?size > )>

  <ol>

  <#list msgs as msg>

  <#if (msg?is_method)>

  <li>${msg[]}</li>

  <#else>

  <li>${msg}</li>

  </#if>

  </#list>

  </ol>

  <#elseif (msgs?size == )>

  <#if (msgs[]?is_method)>

  <li>${msgs[][]}</li>

  <#else>

  <li>${msgs[]}</li>

  </#if>

  </#if>

  </td>

  </tr>

  <#if rootloc??>

  <tr>

  <td><strong>File</strong>:</td>

  <td>${rootlocURI}</td>

  </tr>

  <tr>

  <td><strong>Line number</strong>:</td>

  <td>${rootloclineNumber}</td>

  </tr>

  <#if (lumnNumber >= )>

  <tr>

  <td><strong>Column number</strong>:</td>

  <td>${lumnNumber}</td>

  </tr>

  </#if>

  </#if>

  </table>

  </div>

  <#if rootloc??>

  <#assign snippet = rootlocgetSnippet() />

  <#if (snippet?size > )>

  <div id=snippet>

  <hr />

  <#list snippet as line>

  <#if (line_index == )>

  <#if (lumnNumber >= )>

  <pre >${(line[(lumnNumber)]?html)}<span >${(line[(lumnNumber)]?html)}</span><#if ((lumnNumber)<linelength())>${(line[(lumnNumber)]?html)}</#if></pre>

  <#else>

  <pre >${line?html}</pre>

  </#if>

  <#else>

  <pre>${line?html}</pre>

  </#if>

  </#list>

  </div>

  </#if>

  </#if>

  <div id=stacktraces>

  <hr />

  <h>Stacktraces</h>

  <#list chain as ex>

  <div class=stacktrace >

  <strong>${ex}</strong>

  <div>

  <pre>

  <#list exstackTrace as frame>

  ${frame}

  </#list>

  </pre>

  </div>

  </div>

  </#list>

  </div>

  <div class=footer>

  <hr />

  <p>

  You are seeing this page because development mode is enabled  Development mode or devMode enables extra

  debugging behaviors and reports to assist developers  To disable this mode set:

  <pre>

  strutsdevMode=false

  </pre>

  in your <code>WEBINF/classes/strutsproperties</code> file

  </p>

  </div>

  </body>

  </html>


From:http://tw.wingwit.com/Article/program/Java/hx/201311/25931.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.