I remember working on a project with a group of developers and they always wanted static
 html text to be inside of an out tag (<c:out value="words" />). I don't remember why
 this was the case.
Is this really a best practice when building jsp pages? What are the advantages/disadvantages of such an approach?
It is a terrible idea for static text. You then have no barrier as to what is static and what is dynamically generated.
Besides which, on Servlet Spec 2.3+ you can have dynamic text mixed with static text as:
This is static, not ${dynamic} text.
The only reasons to use c:out tags, in my experience:
You're using an older servlet spec, and need them to output DYNAMIC text in some fashion
You want to escape HTML output to avoid using <>, etc, replacing ampersands with their control codes, etc.
Otherwise, having them use static text confuses the programmer or maintainer...now where did I put that EL?  It was in a c:out tag...but so was fifty other lines of static text!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With