[opencms-dev] Is something wrong with cms:include when nested?

Claus Priisholm cpr at codedroids.com
Tue Sep 5 08:45:43 CEST 2006


I've experienced a similar problem 
(http://mail.opencms.org/pipermail/opencms-dev/2006q3/024896.html) - my 
best guess is that it has to do with the juggling of JspWriters or the 
cache mechanism (or both).

I ended up doing a servlet filter since it solved the immediate problem 
(and the performance overhead was not an issue), but I do think it would 
be useful to be able to wrap the <cms:include>-tag just like you can 
most other tags.

Stefan Uldum Grinsted wrote:
> Hi list (and OpenCMS developers)
> 
>  
> 
> I know nested Tags always are a hurdle, but I have found a particular 
> strange behavior of cms:include in OpenCMS 6.2.2 when nesting it inside 
> a c:set.
> 
>  
> 
> I have replicated it using the following. I have 3 files:
> 
> - blank.txt
> 
> - child.txt
> 
> - parent.jsp
> 
>  
> 
> The blank.txt is of course an empty file of the type plain.
> 
> The child.txt is a plain document containing the following line:
> 
> I am a child
> 
>  
> 
> The parent.jsp looks like this:
> 
> <%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
> 
> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
> 
> <c:set var="child">
> 
> <cms:include page="child.txt" />
> 
> </c:set>
> 
> This should be the child: ${child}<br/>
> 
> And it should have ended here, because this should be the blank.txt:<br/>
> 
> <cms:include page="blank.txt" />
> 
>  
> 
>  
> 
> If it wasn’t for the last line, including the blank file, *nothing* is 
> in the response. Not even the “This should be the child”-text
> 
>  
> 
> I tried to add the last line mostly because I have tried everything 
> else, and the most peculiar thing is, the response then looks like this:
> 
> This should be the child: <br/>
> 
> And it should have ended here, because this should be the blank.txt:<br/>
> 
> I am a child
> 
>  
> 
>  
> 
>  
> 
> I would have just used a <cms:include page=”child.txt” var=”child” /> if 
> such a functionality had been available, as it unfortunately isn’t.. yet.
> 
> The reason for all this hurdle is that I have a jsp, which generates a 
> menu structure as xml, which is the “child” I want to include, and then 
> use the xml:transform from jstl to generate some html for the menu.
> 
>  
> 
> The use of xml:transform brought up some issues itself. Is it true that 
> the jar file xalan.jar is modified in the opencms distribution?
> 
> Usually the org/apache/xalan/res/XSLTInfo.properties has the following 
> lines:
> 
> org.xml.sax.driver=org.apache.xerces.parsers.SAXParser
> 
> # org.xml.sax.driver=org.apache.crimson.parser.XMLReaderImpl
> 
> But the one in the opencms distribution has these lines:
> 
> # org.xml.sax.driver=org.apache.xerces.parsers.SAXParser
> 
> org.xml.sax.driver=org.apache.crimson.parser.XMLReaderImpl
> 
>  
> 
> And that is even though the crimson parser is not part of the classpath. 
> (not on Tomcat 5.5 running on JDK 5). And that resulted in the following 
> error:
> 
> "SAX2 driver class org.apache.crimson.parser.XMLReaderImpl not found"
> 
>  
> 
> But when I commented out the line which sets the driver class in the 
> properties file, everything worked fine.
> 
>  
> 
> Anyways. This last bit was a bit of a side-kick, but the original 
> problem remains. And I would really like to figure out why you can’t 
> nest cms:include inside c:out.
> 
>  
> 
> Good evening, and enjoy.
> 
>  
> 
> Cheers, Stefan.
> 
> 
> ------------------------------------------------------------------------
> 
> 
> _______________________________________________
> 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

-- 
Claus Priisholm, CodeDroids ApS
Phone: +45 48 22 46 46
cpr (you know what) codedroids.com - http://www.codedroids.com
cpr (you know what) interlet.dk - http://www.interlet.dk
--
Javadocs and other OpenCms stuff: 
http://www.codedroids.com/community/opencms




More information about the opencms-dev mailing list