Yes, sharing content was one goal, but using less scriptlets & more tags
is another. An informed developer might import the JSTL functions...

<%@ taglib uri="http://java.sun.com/jsp/jstl/functions"; prefix="fn" %>


...and use...

<c:set var="page_uri"><%=
(info.magnolia.cms.core).Path.getOriginalURI(request) %></c:set>
<c:set var="page_uri2">${fn:split(page_uri,".")[0]}</c:set>

      <cms:ifEmpty contentNodeCollectionName="leftParagraphs">
        <cms:loadPage path="udhome"/> 
        <cms:contentNodeIterator
contentNodeCollectionName="leftParagraphs"> 
        <cms:includeTemplate />
        </cms:contentNodeIterator>
          <cms:loadPage path="${page_uri2}"/>
      </cms:ifEmpty>


...instead of...

<%
String page_uri = (info.magnolia.cms.core).Path.getOriginalURI(request);
String[] page_uri2 = StringUtils.split(page_uri, ".");
%>

      <cms:ifEmpty contentNodeCollectionName="leftParagraphs">
        <cms:loadPage path="udhome"/> 
        <cms:contentNodeIterator
contentNodeCollectionName="leftParagraphs"> 
        <cms:includeTemplate />
        </cms:contentNodeIterator>
          <cms:loadPage path="<%= page_uri2[0] %>"/>
      </cms:ifEmpty>



...not sure why I have to set the split string into a 2nd variable
instead of splitting it right in the 'loadPage' tag, but I guess it
doesn't matter.

<cms:loadPage path="${fn:split(page_uri,".")[0]}"/>

  JasperException: /templates/jsp/ud/global/ud_left.jsp(98,43)
Unterminated &lt;cms:loadPage tag


Well, maybe you all didn't know about the JSTL functions, or figured it
to be common knowledge. Perhaps you can answer me this.

Why do I need to preceed 'Path' with '(info.magnolia.cms.core)' when
'core' has already been imported & should be in the environment?

Is there a way to capture that original URI into a 'c' tag without using
an expression tag?

Ie. <c:set var="page_uri">${Path.getOriginalURI(request)}</c:set>

HTH
Bob V



> I should split the page_uri by the '.' and take the first half.

Please check out StringUtils from Apache Commons. It has everything you
need to make working with Strings a pleasure in Java.

Regards
Boris Kraft


----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/magnolia/developer.html
----------------------------------------------------------------

Reply via email to