1 : <cms:user> user 標簽提供了讀當前用戶的屬性的方法
2 : <cms:property> 讀取當前文件的屬性
3 : <cms:link> 該標簽為一個 VFS 資源生成有效的 OpenCms URL
4 : <cms:label> 讀取 OpenCms 本地化屬性文件中的字符串(僅當需擴展 OpenCms 工作區時使用)
5 : <cms:include> 用于運行中從 OpenCms VFS 動態包含文件,包含的文件被當成一個請求的附加參數。
6 : <cms:template> template 標簽允許您把一個 JSP 頁面分割成多個元素,以便使用 <cms:include> 引入。
7 : <cms:contentcheck> 檢查 XML 內容的項目是否存在
8 : <cms:contentloop> 該標簽用來循環取出 XML 內容列的全部元素
9 : <cms:contentshow> 該標簽用于顯示 XML 內容的列的值
10 : <cms:contentload> 載入一個 XML 內容資源的 collection ,根據給定的 collector 屬性,確定是單個資源還是資源列表
11 : <cms:info> info 標簽顯示系統的運行信息以及底層支撐的
Java/Servlet/OS
環境信息。這個標簽是通過標準的
System.getProperty(value)
來獲得 Java 虛擬機信息的。如果給出的 property 的值沒有對應的鍵值時,會返回錯誤信息。
二、一些問題
1. 路徑問題: 代碼:
<cms:contentload collector="allInFolderDateReleasedDesc" param="TEEMA_Ad/Home/Banner_Text/|teemaAd" editable="true">
如果在OPENCMS后臺打開JSP頁面時,該param下內容無法顯示,須另開窗口,對應URL才可顯示。
?
2.如何顯示目錄下的內容。
<% if? (getResourceCount(__cms,? " TEEMA_Ad/Home/Wide_Block_1/|teemaAd " ,? false )? >?? 0 ) {? %>??
???
< cms:contentload collector = " allInFolderDateReleasedDesc "? param = " TEEMA_Ad/Home/Wide_Block_1/|teemaAd "?
editable = " true " >?
? < img src = " /eeonline/cms<cms:contentshow element= " Image / Image " /> "? width = " 440 "? height = " 75 " >?
??????????? <%??? }? %>?
?????????????????? </ cms:contentload >?
<%?
??? }
%>??
?
3 .創建文件類別 在opencms-modules.xml中:
< explorertype name = " teemaNews "? key = " fileicon.teemaNews "? icon = " article.gif "? reference = " xmlcontent " >?
< newresource page = " structurecontent "? uri = " newresource_xmlcontent.jsp?newresourcetype=teemaNews "? order = " 4 "
?autosetnavigation = " false "? autosettitle = " false " />?
< accesscontrol >?
< accessentry principal = " GROUP.Administrators "? permissions = " +r+v+w+c " />?
< accessentry principal = " GROUP.Projectmanagers "? permissions = " +r+v+w+c " />?
< accessentry principal = " GROUP.Users "? permissions = " +r+v+w+c " />?
</ accesscontrol >?
</ explorertype >?
===============================================?
< type? class = " org.opencms.file.types.CmsResourceTypeXmlContent "? name = " teemaNews "? id = " 1003 " >?
< properties >?
< property >?
< name > content - conversion </ name >?
< value type = " shared " ><! [CDATA[cleanup;xhtml]] ></ value >?
</ property >?
< property >?
< name > template - elements </ name >?
< value type = " shared " ><! [CDATA[ / system / modules / com.teema.eeonline / pages / detail - news.html]] ></ value >?
? </ property >?
? </ properties >?
< param name = " schema " >/ system / modules / com.teema.eeonline / schemas / teemaNews.xsd </ param >?
</ type >?
?
在后臺schemas中,新建文件,類別為xsd,然后eidt source。代碼請參考相關文件。
4 .模板文件的使用???? 選擇文件,右鍵屬性->高級
然后在template中輸入對應的模板路徑。
本工程的模板目錄路徑為上圖所示,每個模板的功能,都有相應的說明。
5 . 文件包含與變量問題
a) 不能在包含的js文件里,引用父JSP文件的變量。
b) 最好不要用 <jsp include 來包含文件而采用<%@ include file,否則如果模板文件沒有發布,無法識別其改動。
6. 關于文件發布
?? a) 同步后,要進行發布,更改后的文件才能生效。
b) 個別文件的改動發布,如果改動到模塊文件所包含的文件,發布時,不能只發布包含文件 ,而模板文件也要改動再發布。
7 .關于 ContentLoad Tag 中的變量
????
1) go to WEB-INF/opencms.tld and add? <rtexprvalue>true</rtexprvalue>
2) Alternatively you could put the value into the pageContext? (<c:set var="file">/sites/default/xyz.html</c:set>)?
and then use a macro "<cms:contentload...param="${pageContext.file}">..." .
8 . Accessing files with a new CmsObject instance??
import org.opencms.file.CmsObject;
import org.opencms.file.CmsProject;
import org.opencms.main.CmsException;
import org.opencms.main.OpenCms;
// ...
cmsObject = OpenCms.initCmsObject( "Guest" );
cmsObject.loginUser( "Admin", "admin" );
???????????
CmsProject cmsProject = cmsObject.readProject( "Offline" );
cmsObject.getRequestContext().setCurrentProject( cmsProject );
???????????
cmsObject.getRequestContext().setSiteRoot( "/" );
????
??????
9. 后臺頁面form文本域的提交,所在的類CmsToolManager.initParams(CmsToolDialog wp)??