[opencms-dev] embedding a jsp page into the main body of templateone template

Joe Desbonnet jdesbonnet at gmail.com
Wed Sep 14 15:31:33 CEST 2005


What you can do, is make a JSP page and include the template header at the 
start and the template footer and the end. In that way the output from your 
JSP appears in the center area.

Here is a simple sitemap script which illustrates this:

<%@ page session="false" %>
<%@ page import="java.util.*" %>
<%@ page import="org.opencms.jsp.*" %>
<%@ page import="org.opencms.file.*" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>

<%!
public void buildSiteMap(org.opencms.jsp.CmsJspActionElement cms,
String uri, java.io.Writer out) throws Exception {

String desc;
List navList = cms.getNavigation().getNavigationForFolder(uri);

if (navList.size() > 0) {

out.write("<ul>\n");

Iterator navItem = navList.iterator();
CmsJspNavElement nav;
String target;
while (navItem.hasNext()) {
nav = (CmsJspNavElement) navItem.next();
if (nav != null) {
target = nav.getResourceName();

out.write("<li>");

if (nav.isFolderLink()) {
target = cms.link(target + "index.html");
} else {
target = cms.link(target);
}

out.write("<a href=\"" + target + "\">" + nav.getNavText() + "</a>\n");

desc = nav.getDescription();
if (desc != null) out.write("  " + desc);

if (nav.isFolderLink()) {
buildSiteMap(cms, nav.getResourceName(), out);
}

}
}

out.write("</ul>\n");

}
}
%>

<cms:include property="template" element="head" />
<h2>Site map</h2>
<%
CmsJspActionElement cms = new CmsJspActionElement (pageContext, request, 
response);
buildSiteMap(cms, "/", out);
%>

<cms:include property="template" element="foot" />




On 9/14/05, philip lau <pcllau at gmail.com> wrote:
> 
> Hi All,
> 
> I have successfully created an intranet using the templateone
> template. But one thing I really would like to be able to do, is to
> have jsp pages in the main body section of the templateone template.
> 
> Thanks,
> 
> Philip Lau
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20050914/f0b117ce/attachment.htm>


More information about the opencms-dev mailing list