Performance of using jsf outputText to render html
A quick question, which is better performance and memory wise:
<t:outputText escape="false" value='<tr><td>'/>
or just a straight
开发者_开发技巧<tr><td>
I ask because I haven't found any documentation regarding which is best performance wise and for general maintainability of the JSFs. I believe the latter results in more maintainable code (you can identify mismatched tags easier), but I'm unaware if there are reasons someone would want to explicitly output html elements using outputText.
Just put HTML straight in the view. Not only have the components indeed an extra memory/resource overhead which you'd like to minimize, but it's also much better readable.
The example as you posted will by the way also not parse when you're using Facelets instead of JSP as view technology.
I am afraid the first example won't work at all:
outputText
is usually generated as <span> tag with the text inside so it will not do what you want EDIT: See comments- It is possible that it will escape the < and > characters so it will not create html tags
tr
andtd
at all, just the text:<tr><td>
(see escape attribute)
The second is generally not a good idea since the tag is intended to output text to the page and not html tags.
精彩评论