Search code examples
htmljspservletsslingsightly

JSP content in sightly


A JSP file, like a HTML file can be requested directly in url. However, a JSP file gets compiled during runtime and HTML file doesn't (Although they are both requested the same way). Even a JSP file with no dynamic content gets compiled during runtime because they get converted into servlets internally. We can include a HTML file inside a JSP file but not the other way around. There are so many components involved in providing resource to the user (Servlets, Request, Response, Webserver etc).

  1. Which component decides whether the file needs to be compiled by looking at its extension?

  2. Sightly is a HTML file and can contain JSP code within its body which ideally shouldn't get compiled but does. How?


Solution

  • Sightly can only be included as part of a component. Although sightly is HTML5 (ends with .html), sightly gets compiled by Sightly engine. So it is possible to have a sightly file that includes JSP file.