我知道这可能是一个愚蠢的问题,但我正在尝试理解opencms中的jsp模板。
即使我们在jsp中有htm标签。cms标签的实际用途是什么,例如:
<cms:template element="body">
<cms:include element="body" />
发布于 2014-05-27 20:27:33
如本维基模板中所述,您可以通过cms标记cms:page在jsp文件中定义模板部分,然后通过cms标记cms:include将它们包含在jsp页面中。
发布于 2017-03-31 13:45:42
模板cms:标签
使用标记,您可以将控制结构添加到模板中,从而使其能够处理多个页面元素。
包含cms:标签
此标记用于在运行时动态包含来自OpenCms VFS的文件。所包含的文件被视为具有可选附加请求参数的请求。通过使用以下属性之一,可以使用不同的选项来确定包含文件的名称:- page - property - attribute
如果没有设置这些属性,则计算标记的正文,并将结果用作文件名。
<%@ page session="false" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
<cms:template element="head">
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><cms:property name="title" escapeHtml="true" /></title>
<meta HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; CHARSET=<cms:property name="content-encoding" default="ISO-8859-1" />">
<link type="text/css" rel="stylesheet" href="<cms:link>../resources/mystyle.css</cms:link>">
<cms:editable />
</head>
<body>
<h2>My first template head</h2>
<!-- Main page body starts here -->
</cms:template>
<cms:template element="body">
<h2>This is the first page element:</h2>
<cms:include element="body" editable="true"/>
<cms:template ifexists="body2">
<h2>This is the second page element:</h2>
<cms:include element="body2" editable= "true"/>
</cms:template>
</cms:template>
<cms:template element="foot">
<!-- Main page body ends here -->
<h2>My first template foot</h2>
</body>
</html>
</cms:template>https://stackoverflow.com/questions/22450769
复制相似问题