為什么在JSP中使用OpenCms特性? <%...@ taglib prefix="cms" uri="http://www./taglib/cms" %>
<h1>Simple taglib example</h1> The installed OpenCms version is <cms:info property="opencms.version"/>.<p> The "title" property of this file is "<cms:property name= "title"/>".<p> Link to a file in the OpenCms VFS <a href="<cms:link>/alkacon-documentation/index.html</cms:link>">like this</a>.<p> 執(zhí)行結(jié)果如下: OpenCms 腳本 API 在你的腳本中訪問OpenCms API,首先要?jiǎng)?chuàng)建一個(gè) JavaBean <%@ page import="java.util.*,org.opencms.jsp.*" %><%
// Create a JSP action element CmsJspActionElement cms = new CmsJspActionElement(pageContext, request, response); // Get a simple navigation of all pages / subfolders in the current folder List list = cms.getNavigation().getNavigationForFolder(); Iterator i = list.iterator(); out.println("<h3>A simple sample navigation</h3><ul>"); while (i.hasNext()) ...{ CmsJspNavElement ne = (CmsJspNavElement)i.next(); out.println("<li><a href="" + cms.link(ne.getResourceName()) + "">"); out.println(ne.getTitle() + "</a>"); } out.println("</ul>"); %>
|
|