首页 技术 正文
技术 2022年11月15日
0 收藏 786 点赞 3,993 浏览 1636 个字

axvelocity是一个Web模板引擎模块,来源于Apache Velocity。由于我的Niagara AX的许可没有axvelocity,因此,在palette中没有找到axvelocity。

但可以在平台的My Modules下找到它。

Niagara AX之axvelocity的使用

将axvelocity模块的module.palette下的VelocityServlet拖动到Station的Services下即可开始使用。

Niagara AX之axvelocity的使用

双击Services下的VelocityServlet,出现它的Velocity Document Manager视图。

Niagara AX之axvelocity的使用

在这个视图中可以点击下方的New按钮添加Velocity文档。

Niagara AX之axvelocity的使用

其中最重要的是选择Template File,这个文件可以是任意格式,如文本文件、HTML等,或者以vm结尾,都行,示例如下(velocity1.txt)。

Niagara AX之axvelocity的使用

模板文件选择好了,就可以通过浏览器访问它了,如下。

Niagara AX之axvelocity的使用

问题来了:

模板引擎的作用是在模板文件中显示不同Java对象的信息,这些Java对象从哪里来呢?

比如,上面展示的模板文件$user.name、$point.out.value中的user、point来自哪儿?

见下图:

Niagara AX之axvelocity的使用

velocity document的文档需要配置user、point等java对象,其属性视图如下:

Niagara AX之axvelocity的使用

从上图可以看出,需要在Velocity Document的Velocity Context属性下添加Velocity Context Ord Element。

使用结果:

可以通过axvelocity模块展示Niagara系统的信息到HTML界面上,但通过axvelocity来控制Niagara系统里面的点却有些问题,还没搞明白。

axvelocity的语法可以参考apache velocity官网的资料。

最后,Servlet Name的设置,设置完后,访问velocity document的url会有改变,如之前访问是使用:

http://localhost:82/velocity/velocity

更改servlet name后变为:

http://localhost:82/velocityz/velocity

Niagara AX之axvelocity的使用

至于在HTML页面中嵌入PX图,使用frameset+frame或者iframe都可以,关键是要设置正确的src,示例如下:

<frameset cols=”300,*”>
<frame src=”/ord?file:^html/menu.html” />
<frame src=”/ord?station:|slot:/Services” name=”content” />
</frameset>

<body>
<iframe src=”/ord?file:^html/menu.html” style=”width:19%;height:100%;”></iframe>
<iframe src=”/ord?station:|slot:/Services” name=”content” style=”width:80%;height:100%;”></iframe>
</body>

注意下面的url:

<body>
<a href=”/ord?station:|slot:/Services/UserService” target=”content”>用户管理</a>
<br/>
<a href=”/ord?history:/Ben0721/AuditHistory” target=”content”>历史记录</a>
<br/>
<a href=”/velocity/velocity” target=”content”>velocity</a>
<br/>
<a href=”/velocity/velocity2″ target=”content”>velocity 2</a>
</body>

velocity的访问连接是不同的,没有/ord?开头。

ORD可以在Workplace里通过Ctrl + L获得,去掉ORD前面的local:|fox:1912|即可。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,490
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,905
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,738
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,491
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,129
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,292