[opencms-dev] the cms:include tag is driving me crazy

Michael Emmerich emmerich at german-navy.de
Mon Dec 28 08:19:37 CET 2009


Tim,

if you use the

<cms:include
  file="/system/modules/genvega/templates/common_elements/common.jsp" 
element="htmlhead"/>

Tag, everything inside the <cms:template 
element="htmlhead">...</cms:template> is included AND everything that is 
not inside a <cms:template ...> tag as well.

So if you seperate a jsp by unsing the <cms:template> tag, take care 
that all parts of your JSP are inside one of those tags.
Normally your JSP would at least look like this:

<cms:template element="htmlhead">
HTML code here
</cms:template>
<cms:template element="htmlfoot">
HTML code here
</cms:template>

No HTML must be outside the <cms:template> tags!

Kind regards,
Michael Emmerich


> Folks,
> 
> I have consulted the wiki, Liliedahl book and the javadocs etc. I am 
> trying to do the very simple task of including an element of another 
> file into my jsp using the cms:include tag. For whatever reason, opencms 
> keeps including the entire target file instead of the named element. I 
> must have a mistake somewhere but i cant seem to find it. How does one 
> do this? Here is what I have in my calling JSP:
> 
> <cms:include 
> file="/system/modules/genvega/templates/common_elements/common.jsp" 
>  element="htmlhead"/>
> 
> and here is the common.jsp
> 
> <%@ page language="java" contentType="text/html; charset=UTF-8"
>     pageEncoding="UTF-8"%>
> <%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
> 
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> *<cms:template element="htmlhead">*
> <head> 
> <title><cms:property name="Title" escapeHtml="true" /></title>
> <meta http-equiv="Content-Type" content="text/html; />
> <link rel="stylesheet" type="text/css" 
> href="<cms:link>../resources/css/style.css</cms:link>" />
> <link rel="stylesheet" type="text/css" 
> href="<cms:link>../resources/css/style_cf.css</cms:link>" />
> <link rel="stylesheet" type="text/css" 
> href="<cms:link>../resources/css/reset.css</cms:link>" />
> <link rel="stylesheet" type="text/css" 
> href="<cms:link>../resources/css/prettyPhoto.css</cms:link>" 
> media="screen" />
> <!-- link rel="stylesheet" type="text/css" href="css/style.css" />
> <link rel="stylesheet" type="text/css" href="css/style_cf.css" />
> <link rel="stylesheet" type="text/css" href="css/reset.css" />
> <link rel="stylesheet" type="text/css" href="css/prettyPhoto.css" 
> media="screen" / -->
> 
> <script type="text/javascript" 
> src="<cms:link>../resources/js/jquery-1.3.2.min.js</cms:link>"></script>
> <script type="text/javascript" 
> src="<cms:link>../resources/js/jquery.cycle.all.min.js</cms:link>"></script>
> <script type="text/javascript" 
> src="<cms:link>../resources/js/jquery.easing.1.1.1.js</cms:link>"></script>
> <script type="text/javascript" 
> src="<cms:link>../resources/js/script.js</cms:link>"></script>
> <script type="text/javascript" 
> src="<cms:link>../resources/js/jquery.prettyPhoto.js</cms:link>"></script>
> <script t......
> 
> continued till 
> *<cms:template>*
> and further until </html>
> 
> 
> ------------------------------------------------------------------------
> 
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev


-- 
Home   : emmerich at german-navy.de
Work   : m.emmerich at alkacon.com
WWW    : German Naval History http://www.german-navy.de



More information about the opencms-dev mailing list