电脑故障

位置:IT落伍者 >> 电脑故障 >> 浏览文章

freemaker的标记语法


发布日期:2022/6/17
 

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

上一篇:一些简单的程序的实现续

下一篇:试简单概括面向对象接口编程