免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1603 | 回复: 0
打印 上一主题 下一主题

opencms中JSP标签详解二 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-04-20 17:17 |只看该作者 |倒序浏览

                                                标签:
opencms中这个标签是用于加载xml结构化资源集的,根据定义在搜集器(Collectors)中的具体属性值(collector的值),无论单一的xml内容资源还是一个资源集(对于资源集,此标签可循环加载其中的资源)都将在此标签中被加载。
属性:
名称
描述                                                               
是否必须
collector
collector属性用于读取xml内容资源的,各种类型的搜集器被定义为不同的java类,这些java类配置在文件opencms-vfs.xml中,opencms中声明了一个包含以下搜集器的类:CmsDefaultResourceCollector
singleFile
获取一个单独的xml内容资源,这个xml资源的名字定义在属性“param”中
allInFolder
获取存在于某个文件夹中的一列xml内容资源,文件夹的名字定义在属性“param”中
allInFolderDateReleasedDesc
获取存在于某个文件夹中的,一列以发布时间区分的xml内容资源,文件夹的名字定义在属性“param”中
allInFolderNavPos
获取存在于某个文件夹中的,一列以“navPos”属性值区分的xml内容资源,文件夹的名字定义在属性“param”中
allInSubTree
获取存在于树型结构中的
一列xml资源,树的根节点定义在“param”中
allInSubTreeDateReleasedDesc
获取存在于树型结构中,一列以发布时间区分xml资源,树的根节点定义在“param”中
allInSubTreeNavPos
获取存在于树型结构中,一列以“navPos”属性值区分xml资源,树的根节点定义在“param”中
定义在类CmsPriorityResourcecollector中的其它有效的搜集器以属性“
collector.priority”和“collector.date”的值来区别资源,如下的搜集器定义在这个类中:
allInFolderPriorityDateDesc
获取存在于某个文件夹中的,一列以“collector.priority”属性值区分xml资源,如果某些资源有相同的priority属性值,则“collector.date”属性值将被用于区分的候选标准,文件夹的名字定义在属性“param”中
allInFolderPriorityTitleDesc
获取存在于某个文件夹中的,一列以“collector.priority”属性值区分xml资源,如果某些资源有相同的priority属性值,则“Title”属性值将被用于区分的候选标准,文件夹的名字定义在属性“param”中
allInSubTreePriorityDateDesc
获取存在于树型结构中的,一列以“collector.priority”属性值区分xml资源,如果某些资源有相同的priority属性值,则“collector.date”属性值将被用于区分的候选标准,树的根节点定义在属性“param”中
allInSubTreePriorityTitleDesc
获取存在于树型结构中的,一列以“collector.priority”属性值区分xml资源,如果某些资源有相同的priority属性值,则“Title”属性值将被用于区分的候选标准,树的根节点定义在属性“param”中
如果不想把搜集器的collector属性值写死,可以在宏中定义collector的名字,然后在jsp中使用宏属性collector取出搜集器名,例如:${property.collector}                                                
yes
param
param属性用于给collector提供额外的信息,当使用一个类CmsDefaultResourceCollector中定义的搜集器,param属性将提供xml资源名以供collecotor读取,这个参数的格式为:“[filename]|[resource
      type]|[count]”
[filename]
被加载资源的名字,它可以包含一个markro值“${number}”,这个值将在循环单个xml资源时取代下一个xml资源(The name of the resource to load, it can include
      a makro value "${number}", which replaced with the number of the the next
      xml content resource while looping through the single elements.)
[resource type]
指定一个在opnecms-vfs.xml中声明过的xml内容资源类型
[count]
Will use the current uri in the OpenCms VFS as resource name. Its
      typical to use this with the singleFile collector a detail view jsp.
你也同样可以使用宏表达式语言设置collector的param属性的值,例如:
${property.xml-content}
param属性值将被属性xml-content的值替代
${opencms.uri}
   Will be replaced by the current OpenCms VFS URI. Its
      typical to use this with the singleFile collector a detail view jsp.
${opencms.filename}
param属性值将被当前的xml资源名替代,在循环单个资源时
${param.resourceType}
param属性值将被http请求参数“resourceType”的值替代

editable
这个属性声明xml资源文件是否支持直接编辑,以下值将被付给这个属性:
ture
xml资源支持直接编辑
faulse
xml资源不支持直接编辑

Body:
Any HTML, JSP or JSTL code of your template, this code
will be looped if the selected collector will return more than one xml content
items.
Example usage:
A detail view of a xml content resource would use a contentload tag as following:
cms:contentload collector="singleFile" param="${opencms.uri}" editable="true">
...
cms:contentload />
An example to read all xml content resources of the resource type 11
in a sub tree starting with the folder "/xml-content/" in the current
site. You need to set a property "collector" with the value
"allInSubTree" on the JSP, together with a property "xm-content" with
the value "/xmlcontent/":
cms:contentload collector="${property.collector}" param="${property.xml-content}article_${number}.html|11" editable="true">
...
cms:contentload />
               
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/23447/showart_282646.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP