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

philip lau pcllau at gmail.com
Tue Sep 27 11:19:58 CEST 2005


Hi Joe,

Thanks for your help. That piece of code did the trick. I was also
wondering can I include redirection in the body of this code so that
the redirection would include the menu navigation as well.

Thanks,

Philip Lau

On 14/09/05, Joe Desbonnet <jdesbonnet at gmail.com> wrote:
> 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
> >
>
>



More information about the opencms-dev mailing list