Difference between sightly and jsp?

1.4k views Asked by At

Why is there a need to move away from JSP codes when the world doing just fine with it? When I ask the difference between JSP and sightly I only find the advantages of sightly but I want to how are they different fundamentally? What does it mean when they say sightly provides better segregation of business logic and HTML?

1

There are 1 answers

0
Vlad On BEST ANSWER

You can do just fine with JSPs, there is no need to switch to HTL/Sightly. Sling and AEM/CQ decided to recommend HTL due to its advantages: security (XSS protection out of the box), separation of concerns, support for internationalization etc. But JSP is still supported and there are extensions for other scripting/templating languages (Thymeleaf for example).

A templating language generally separates presentation/view (a HTL template for example) from the model (an Use-Object in case of HTL). This separation of concerns makes you code more modular and reusable, easier to test (you can unit test your Use-Objects) and generally avoids the spaghetti monsters that live in many JSPs.

A good developer can write nice JSPs as well, but many times that's not the case.