Both the ComponentPresentationAssembler
classes from the com.tridion.dynamiccontent
package, or the deprecated com.tridion.web.jsp
package return the content of the dynmamic component presentation as-is, i.e. without the executed Java code. The Java code is displayed in the HTML source.
Example code from a test.jsp
page:
<%
com.tridion.web.jsp.JSPPage webPage =
new com.tridion.web.jsp.JSPPage(pageContext, "tcm:127-243236-64");
com.tridion.web.jsp.ComponentPresentationAssembler webAssembler =
new com.tridion.web.jsp.ComponentPresentationAssembler(webPage);
String title = webAssembler.getContent(455985, 243136);
out.print("Title = " + title + "<br>");
String content = webAssembler.getContent("tcm:127-455985", "tcm:127-243135-32");
out.print("Content = " + content + "<br>");
%>
Example code (2) from a test.jsp
page:
<%
com.tridion.web.jsp.JSPPage webPage =
new com.tridion.web.jsp.JSPPage(pageContext, "tcm:127-243236-64");
com.tridion.dynamiccontent.ComponentPresentationAssembler dynamicAssembler =
new com.tridion.dynamiccontent.ComponentPresentationAssembler(webPage);
String title = dynamicAssembler.getContent(455985, 243136);
out.print("Title = " + title + "<br>");
String content = dynamicAssembler.getContent("tcm:127-455985", "tcm:127-243135-32");
out.print("Content = " + content + "<br>");
// poging 2
dynamicAssembler = new com.tridion.dynamiccontent.ComponentPresentationAssembler(
"tcm:0-127-1", application, request, response);
%>
The HTML source displays the content of the componentpresentation as well as the Java code from the template itself.
Tridion 2011 SP1 is used together with Tomcat and a working/configured Content Delivery. Publication target language is set to JSP. Dynamic Component Template has checked "Allow on Page Using Dynamic Assembly".
Logfiles doesn't show any warnings or errors except:
2013-10-21 12:18:24,625 WARN Admin - WAI: Could not find a presentation for SiteIdentifier[Protocol=http; Domain=localhost; Port=8080; Path=/tridion.jsp]
Update
DCP's are indeed stored in a broker database (Oracle)
Update 2
Both Publication target and Template Output is set to REL. Unpublished the templates, checked that no CP's are in DB. Republished the templates, but CP's still display Java code.
Added the TLD stuff as suggested below, restarted Tomcat, but same problem. CP's still display unexecuted Java code.
Update 3 (2013-10-23):
Reconfigured to publish the DCP's to the filesystem, same result. JSP code (above) displays HTML and unexecuted Javacode.
I ask myself, if there is configuration missing, one that instructs Tridion to use a JSP CP class instead of a plan CP class impl.