[opencms-dev] Re ndering an element with a certain formatter programmatically

Fr3z roel.frison at redtree.be
Wed Nov 14 15:43:59 CET 2012


I have the UUID of an element (fe a news item), so I can acces its entire
xmlcontent.

Now, is there a way to programmatically render this element in a jsp with a
formatter of my choice instead of copying the code of the formatter in this
jsp?

I was trying via:

<%
	
	CmsUUID elementId = new CmsUUID("368253f9-280e-11e2-87b4-6f30f3c96804");
//hardcoded UUID for testing purposes
	
	CmsResource formatter =
cms.readResource("/system/modules/be.redtree.crelan.intranet.news/formatters/detail.jsp");
	CmsUUID formatterId = formatter.getStructureId();

	CmsContainerElementBean containerelement = new
CmsContainerElementBean(elementId, formatterId, null, false);
%>

But I can't seem to get any further.

Actually I'm looking for some kind of method that does this:
render(XMLcontent,formatter) and then displays it correctly.

Anyone has any advice, help, manual about this?

Kind regards,

Roel Frison
-- 
View this message in context: http://old.nabble.com/Rendering-an-element-with-a-certain-formatter-programmatically-tp34678886p34678886.html
Sent from the OpenCMS - Dev mailing list archive at Nabble.com.




More information about the opencms-dev mailing list