`

MVEL2.0模板(基本模板)

阅读更多

MVEL 2.0 Basic Templating

MVEL Templates are compromised of orb-tags inside a plaintext document. Orb-tags denote dynamic elements of the template which the engine will evaluate at runtime.

If you are familiar with FreeMarker, this type of syntax will not be completely alien to you.

For a list of all orb-tags included in MVEL 2.0 click here

A Simple Template

Hello, @{person.getSex() == 'F' ? 'Ms.' : 'Mr.'} @{person.name}

This e-mail is to thank you for your interest in MVEL Templates 2.0.

This template shows a simple template with a simple embedded expression. When evaluated the output might look something like this:

Hello, Ms. Sarah Peterson

This e-mail is to thank you for your interest in MVEL Templates 2.0.

Escaping the @ symbol

Naturally, since the @ symbol is used to denote the beginning of an orb-tag, you may need to escape it, to prevent it from being processed by the compiler. Thankfully, there is only one situation where this is necessary: when you actually need to produce the string '@{' as output in your template.

Since the compiler requires a combination of @ and { to trigger the orb recognition, you can freely use @ symbols without escaping them. For example:

Email any questions to: foo@bar.com

@{date}
@include{'disclaimer.html'}

But in the case where you need an @ symbol up-against an orb-tag, you will need to escape it by repeating it twice:

@{username}@@@{domain}

That's two @'s to escape one symbol, and the third @ being the beginning of the tag. If this looks too messy, you can always use the alternate approach of using an expression tag, like this:

@{username}@{'@'}@{domain}
分享到:
评论

相关推荐

    mvel2.0语法指南.pdf

    ### MVEL 2.0 语法指南精要 #### 一、引言 MVEL (Micro Velocity) 是一种高效、灵活且易于使用的表达式语言,主要用于处理数据和执行计算任务。MVEL 2.0 版本在继承 Java 语法的基础上进行了大量优化,以提高性能...

    MVEL 2.0表达式语言

    2. **算术运算**:MVEL支持基本的数学运算,如加法、减法、乘法和除法,以及取余操作。 3. **比较和逻辑运算**:可以使用比较运算符(如`>`, `, `==`, `!=`)和逻辑运算符(如`&&`, `||`, `!`)来构建条件语句。 4. ...

    mvel2-2.0.18

    功能强大的基于Java应用程序的表达式语言.

    MVEL 2.doc

    MVEL 2.0是其一个版本,提供了更加强大的功能和改进。下面将详细介绍MVEL 2.0的使用方法、核心概念以及如何与应用程序集成。 ### MVEL表达式基础 MVEL表达式的例子如`foo.name == "Mr. Foo"`,这个表达式检查`foo....

    mvel-maven-plugin:MVEL 模板 maven 插件

    mvel-maven-插件 使用 MVEL 渲染模板的 Maven 插件。 用法 < groupId>uk.co.codezen < artifactId>mvel-maven-plugin < version>1.0 < goal>render < template

    \\(^_^)/ 表达式解析器(MVEL)

    **表达式解析器(MVEL)** MVEL是一个强大的、轻量级的动态脚本语言,主要设计用于简化表达式和脚本的编写。...无论是在业务逻辑处理、数据绑定还是模板渲染等方面,MVEL都能提供简洁、高效的解决方案。

    mvel 2.0.15

    Getting Started for 2.0 MVEL is very easy to use, and just as easy to integrate into your application. Let's take a quick look at a simple MVEL expression: foo.name == "Mr. Foo" This simple ...

    MVel 2.0.15 doc

    MVEL是一种表达式语言,与OGNL类似,同时也是一个模板引擎。它的主要功能是提供简洁的语法来访问对象属性、执行循环和条件判断,以及进行字符串格式化等。MVEL模板允许开发者以一种声明式的方式将动态数据嵌入到静态...

    Activiti BPMN2.0设计器eclipse插件

    4. **表达式编辑器**:为流程中的决策和条件提供表达式编辑支持,例如使用MVEL或JUEL表达式语言。 5. **版本控制**:与版本控制系统(如Git)集成,便于团队协作和流程变更追踪。 6. **代码生成**:设计完成后,插件...

    mvel14-1.2.21.jar

    mvel14-1.2.21.jar mvel14-1.2.21.jar

    MVEL脚本语言语法

    很好的MVEL基础语法学习资料,希望能帮到你~

    mvel2-2.3.0.Final.jar

    java运行依赖jar包

    mvel2-2.1.6.Final-javadoc.jar

    mvel2-2.1.6.Final-javadoc

    StarUML text-template example

    模板语言通常基于某种模板引擎,如MVEL或FreeMarker,这些引擎允许用户在模板中嵌入变量和逻辑表达式。在"template.cot"文件中,我们可以找到用这种模板语言编写的代码,这些代码将被StarUML解析并用于生成目标文本...

    mvel2-2.1.0.drools16.jar

    mvel2-2.1.0.drools16.jar mvel2-2.1.0.drools16.jar

Global site tag (gtag.js) - Google Analytics