简体   繁体   中英

Difference between sightly and jsp?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM