Magnolia/Struts/Tiles Integration Suggestion
1. First solution, using separate web contexts
We can import whole content pages (which may contain HTML segments) from Magnolia into a
Tiles page like this:
<!-- Assumes Magnolia is running on this host, having "magnoliaPublic" as its context name: -->
<c:import url='http:<!-- "?id=123" bypasses the caching mechanism and can be removed for production sites -->
2.Second solution, using Magnolia as external web service
We could consume the Magnolia as an external Web Service (provided that we install some in Magnolia and that those services "somehow" retrieve a Magnolia page or paragraph from our struts pages, a WSRP module has been done, so the same idea could be extended to a Web Service, but it is not integrated in Magnolia yet).
So our page would include something that could look like this
<%
String host = "http:;
String servicepath = "/magnoliaPulic/services/Service.jws";
String endpoint = host + servicepath;
String ret = null;
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL (endpoint));
call.addParameter("paragraphOrPageID″, XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);
ret = (String) call.invoke(new Object [] {"paragraphOrPageID"});
System.out.println(ret);
%>
3.Third solution, merging both web contexts into one, using Struts for page navigation
We can append Magnolia's web.xml configuration at the end of Struts web.xml (before </web-app>),
while copying all of the WAR content from Magnolia into the Struts WAR.
In order to access Magnolia content elements from inside of a Tiles page, we can use Magnolia's CMS tags like this:
<jsp:root version="2.0" xmlns:jsp="http: xmlns:cms="urn:jsptld:cms-taglib"
xmlns:cmsu="urn:jsptld:cms-util-taglib" xmlns:c="urn:jsptld:http:
xmlns:bean="http: xmlns:html="http://struts.apache.org/tags-html"
xmlns:logic="http:>
<jsp:directive.page contentType="text/html; charset=utf-8" />
...
<!-- Fetches the content elements from the collection named "contentParagraph" of /welcome.html -->
<cms:loadPage path="welcome"/>
<cms:contentNodeIterator contentNodeCollectionName="contentParagraph">
<cms:adminOnly><cms:editBar/></cms:adminOnly>
<cms:includeTemplate />
</cms:contentNodeIterator>
<cms:unloadPage />
<cms:adminOnly>
<cms:newBar contentNodeCollectionName="contentParagraph" paragraph="samplesTextImage" />
</cms:adminOnly>
...
</jsp:root>
In its previous incarnation on JspWiki, this page was last edited on Feb 9, 2007 10:11:29 AM by Markus