服务热线:13616026886

技术文档 欢迎使用技术文档,我们为你提供从新手到专业开发者的所有资源,你也可以通过它日益精进

位置:首页 > 技术文档 > JAVA > 新手入门 > 基础入门 > 查看文档

wlp8.1 cms 使用经验

  下面是本人在使用wlp8.1内容管理模块过程中的一些经验总结.

  通常做法

  1. 通过wlp admin console进行内容的增,删,改。如果内容比较多,一般通过bulk loader批量加载内容。
  2. 通过content selector查询符合条件的内容,在运行环境下,可以在wlp admin console中定义content selector。
  3. 通过jsp taglib或cms api取内容并显示.

  与cms有关的jsp tag主要有:
<pz:contentselector>
<es:foreachinarray>
<cm:getproperty>
<cm:getnode>
<cm:search>

  cms api 可通过:http://edocs.beasys.com/wlp/docs81/javadoc/overview-summary.html 查到。

  1. 内容的编辑,一般采用相应的工具,并把编辑好的内容,以文件的形式加载到cms repository中。如果需要修改,重新加载即可。
  2. 内容库的搜索,一般包括元数据搜索和全文搜索,元数据搜索一般通过<cm:search>或api实现。全文搜索可通过配置搜索引擎来实现。

  html中图片的处理方法

  在采用wlp的cms来管理站点的内容时,经常要处理包含图片的html文件,因为html中的图片一般都是超连接方法,不同于word等文件是直接包含。为了使html文件以加载到wlp的cms repository中,仍然可以正确显示。可采用以下两种方法。

  1. 把图片放到某个可通过web 方式访问到的目录下, 修改html中的图片连接的url指到该目录。如下所示:
<table cellspacing="0" cellpadding="10" border="0">          <tbody>            <tr>              <td><a href="http://www.bea.com"><img src="http://www.itus.cn/essweb/images/logo_bea.gif" border="0" width="95" height="57"></a></td>            </tr>            <tr>              <td><a href="http://www.flyinglogo.com"><img src="http://www.itus.cn/essweb/images/logo_fls.gif" border="0" width="95" height="83"></a></td>            </tr>          </tbody>        </table>
  1. 另一种方式是把该html保存成mht格式,然后把该mht文件以加载到wlp的cms repository中

wlp8.1 cms 使用经验(图一)

点击查看大图

  在portlet 中显示cms repository中内容

  显示内容的方法一般有以下两种:

  直接显示:直接把内容所对应的文件的内容显示出来

  间接显示:
通过点击内容的标题等,以超连接的方式内容所对应的文件的内容显示出来

  下面分别说明相应的方法:

  直接显示html等内容

  可采用下面的代码,在sp3中正常,在sp4中throw exception:error getting bytes from property: file caused by: : java.lang.nullpointerexception

<body>        <pz:contentselector rule="my" id="nodes"/>        <% if ( nodes == null || nodes.length == 0 )           {        %>             no content found        <%           }           else           {        %>                       <utility:foreachinarray array="<%=nodes%>" id="node" type="com.bea.content.node">            <cm:getproperty id="node" name="file" failonerror="true" />            </utility:foreachinarray>        <%           }        %></body>  直接显示图片的内容<body>           <pz:contentselector rule="untitled" id="nodes"/>            <% if ( nodes == null || nodes.length == 0 )            {            %> no content found            <%            }            else            {            %>                <utility:foreachinarray array="<%=nodes%>" id="node" type="com.bea.content.node">                <%                 string simg = "<img src= ' " + "/sampleportal/showbinary" + node.getpath() + "'>";                out.println(simg);                %>                </utility:foreachinarray>            <%            }            %>   </body>

  注意:在sp3中,如果该node path 中包含汉字,没有login,显示不出来,login之后可以正确显示。不知道为怎么,所以如果要这样显示图片,最好node path不要有中文。

wlp8.1 cms 使用经验(图二)

点击查看大图

wlp8.1 cms 使用经验(图三)

点击查看大图

  间接显示内容

  一般通过超连接方式:

一般通过超连接方式:<netui:html>    <body>           <pz:contentselector rule="my" id="nodes"/>            <% if ( nodes == null || nodes.length == 0 )            {            %> no content found            <%            }            else            {           string myurl = "http://" + request.getservername() + ":" + request.getserverport()+ request.getcontextpath();        system.out.println("myurl="+myurl);            %>                <utility:foreachinarray array="<%=nodes%>" id="node" type="com.bea.content.node">                                 <a href="<%=myurl%>/showbinary<%=node.getpath()%>" ><cm:getproperty name="title" node="<%=node%>" /></a>                                   </utility:foreachinarray>            <%            }            %>   </body></netui:html>

  对内容管理进行委派授权

  可以给不同的部门或分公司建不同的目录,然后通过wlp的委派授权功能,使不同的部门或分公司只能对自己部门或分公司的目录进行内容的增加,删除,修改等管理工作

wlp8.1 cms 使用经验(图四)

点击查看大图

wlp8.1 cms 使用经验(图五)
  作者简介
  dev2dev id: xcjing,bea 资深技术顾问,加入bea中国多年,在门户技术、rfid解决方案上有着丰富的经验。

扫描关注微信公众号