Separating content from a template is always good practice. This way, you donβt need to rebuild, relocate and / or restart all this for any silly / typo / hiccup context changes. ResourceBundle API (which is standard for the JSTL fmt taglib and other i18n / l10n tags) smart is enough to dynamically update resource files with every change (at least if you are using JDK 1.6 or later, which has those enhancements built into ).
In addition, whenever you want to switch i18n or want to switch from a properties file to a database table or something else, you do not need to change the template to extract the contents from it - so that you would be bitten more if you do it later.
Itβs a bit of work to compare the content and layout in the template with each other, I can imagine that this is the main fear among developers / maintainers. I compose the keys myself so that they roughly correspond to pagename.parentid.elementtype.elementname.contenttype (roughly, not all of them are necessary, but this gives an idea), so that it immediately becomes clear where it belongs.
eg. a home.login.label.username.tooltip that points to home.jsp with:
<form id="login"> <label for="username" title="${text['home.login.label.username.tooltip']}">
Keep this agreement in sequence and you will find that it all simplifies.
source share