Since the JSPs always compile down into a servlet before they are
displayed, it behaves just about the same as if you write a scriptlet.
I haven't ever noticed any performance problems - and I rely heavily
on the taglibs to make my jsp templates easy to maintain - and easy
for someone else to edit were I to ever get hit by a bus or
something. Taglibs are nice because they hide what is going on behind
the scenes into one logical line - the loadPage obviously just loads
a page... etc.
After reviewing what Giancarlo wrote, I realized that I forgot about
the Content attribute of the ContentNodeIterator - where you can pass
a page in. What I'd probably do at this point is write another
function for the CMSFN to return a content from the UUID - since
there isn't already a utility function to that (and it seems like it
would be useful to have)
so then I'd write it up to be something like this:
<cms:setNode var="currentNode" />
<cms:contentNodeIterator Content="${fn:getContentByUUID
(currentNode.nodeContainingUUID)} "
contentNodeCollectionName="nameOfContentNodeCollectionInTheOtherPage">
... etc
the cmsfn is a new taglib, and it is where the EL functions live.
I'm a big fan of putting as much crap into the tag libraries as I can
because:
1 - it makes it easy to maintain... if I want to change the
implementation across all pages, I change it one spot (the tag library)
2 - It makes it easy for other to reuse any of my work (gotta help
out the "community" for the "community edition")
3 - It makes my own code easier to understand
There are some things about the taglibs that I don't like. For
instance, I don't like that the TLD is manually edited... Xdoclet2
has nice maven integration and can generate .tld files at build time
- which would make it much easier to make patches for the tag
libraries since I would only have to worry about rolling back one
file - not two... etc. (The drawback is - the tag library is pretty
big right now... and migrating all of the information that is
currently in the TLD into comments for Xdoclet to generate the TLD
file from is something that would be tedious enough I don't think I'd
want to be the one doing all of it - and it kind of has to be done
all-at-once for it to be of much worth as a patch. I suppose the
Magnolia community could say "move towards this kind of annotation of
tag libraries, because as of version X we will be using the xdoclet
generated TLD file as the official TLD - and in the meantime maintain
both the javadoc annotations and the manual TLD file..")
... but that's kind of off topic.
So - the short answer is:
- No... Tag libraries wont give you a big performance hit. If the
code was significant enough to have a noticeable slowdown in
performance, it'd probably be noticed by the hotspot JVM and would be
runtime-optimized anyway...
Ryan
On Mar 10, 2008, at 9:47 PM, Ryan Bales wrote:
Hi Ryan
I basically want to iterate the content nodes of the paragraph
(several actually) and put the returned values in a map. Are there
performance disadvantages to using loadpage?
On Mar 10, 2008, at 9:37 PM, "Ryan Gardner" <user-
[EMAIL PROTECTED]> wrote:
Are you wanting to iterate over that page, or over content in that
page?
Honestly, I'd modify the LoadPage tag to allow a content to be
passed into it in order to make it easy to use existing tags like
this:
<cms:loadPage page="${pageYouGotFromScriptlet}" />
<cms:contentNodeIterator contentNodeCollectionName="name of
content to iterate over on that page" />
</cms:UnloadPage>
Although, in your case - I'd actually modify the cms:loadPage to
take a UUID value to cut out the scriptlet you had likely had to
throw in to grab the Content from the UUID already.
I actually already coded this up, but I haven't bothered testing
it or modifying the TLD.
Here's a diff file for LoadPage.java:
http://pastebin.us/?show=f2b1308ec
You'll have to apply the patch and the modify the TLD file to
mention the new attributes, then recompile and replace the jar file.
When I get done a few more things, I'll to the TLD up and submit a
patch to Jira. My TLD file right now has a lot of extra stuff in
it from other patches I've submitted recently, so it's a pain to
have to unapply all those patches and then apply this one in order
to get the line numbers right... etc.
If you don't feel like messing with this, then Giancarlo's
suggestions in the email I just saw him post seem good too :)
Ryan
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------