Is there something safer than JSP? I haven't found any meaningful answers through Google. We currently use the Spring MVC framework and JSP to render HTML. I have came to hate the dynamic nature of the JSP rendering, in that you reference a model like ${model.someAttribute}
but have no way of telling whether this attribute is available at the given module or specifies the type of the model that the template expects. It becomes very difficult to refactor the models' getters since Eclipse doesn't know which templates use the model and also cannot relate the getters to the property accessors in templates.
Is there a templating technology out there, that is both less ugly than spitting out HTML code via imperative code and more type/compile safe than JSPs?
FreeMarker: An open alternative to JSP.
Spring MVC, Struts or Apache Wicket are examples of web frameworks, whereas JSP, Velocity or FreeMarker are examples of template engines.
You can use type hints, e.g. the type attribute in jsp:useBean and in the attribute declarations of JSP tag files (and probably in other places like JSTL tags). IntelliJ will then do all the good static type-based stuff for you (accurate code completion suggestions, refactoring, find usages, show quick javadoc, etc.).
I just recently wrote about this in the context of JSP tag files.
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