freemaker的标记语法

2014-11-24 10:51:14 · 作者: · 浏览: 0
借Struts2核心jar包下的Filter包的error.ftl文件来学习一下freemaker的标记语法
该ftl模板(error.ftl)用于指示开发者Struts页面请求出错后,指定转向该模板所生成的 html静态页面
<#--
/*
* $Id: error.ftl 720258 2008-11-24 19:05:16Z 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 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*/
-->
Struts Problem Report

Struts Problem Report

Struts has detected an unhandled exception:

<#assign msgs = [] />
<#list chain as ex>
<#if ex.message >
<#assign msgs = [ex.message] + msgs/>
<#assign rootex = exception/>
<#list chain as ex>
<#if (ex.location && (ex.location != unknown))>
<#assign rootloc = ex.location/>
<#assign rootex = ex/>
<#else>
<#assign tmploc = locator.getLocation(ex) />
<#if (tmploc != unknown)>
<#assign rootloc = tmploc/>
<#assign rootex = ex/>
<#if rootloc >
<#if (rootloc.columnNumber >= 0)>
Messages:
<#if (msgs size > 1)>
<#list msgs as msg>
<#if (msg is_method)>
  • ${msg[0]}
  • <#else>
  • ${msg}
  • <#elseif (msgs size == 1)>
    <#if (msgs[0] is_method)>
  • ${msgs[0][0]}
  • <#else>
  • ${msgs[0]}
  • File: ${rootloc.URI}
    Line number: ${rootloc.lineNumber}
    Column number: ${rootloc.columnNumber}
    <#if rootloc >
    <#assign snippet = rootloc.getSnippet(2) />
    <#if (snippet size > 0)>

    <#list snippet as line>
    <#if (line_index == 2)>
    <#if (rootloc.columnNumber >= 3)>
    ${(line[0..(rootloc.columnNumber-3)] html)}${(line[(rootloc.columnNumber-2)] html)}<#if ((rootloc.columnNumber)${(line[(rootloc.columnNumber-1)..] html)}
    <#else>
    ${line html}
    <#else>
    ${line html}

    Stacktraces

    <#list chain as ex>
    ${ex}
     
    <#list ex.stackTrace as frame>
    ${frame}

    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:
     
    struts.devMode=false
    in your WEB-INF/classes/struts.properties file.