1

I created a JSP file directly via CRX into my website. The target is to access it via a direct url instead of a separate template. Example:

http://localhost:4502/content/mywebsite/somepage/test.jsp

But the browser just gives me option to download it instead of opening and processing the jsp and the code inside it. I cannot use an HTML file as I need to run some Java code in this JSP.

Riju Mahna
  • 6,718
  • 12
  • 52
  • 91
  • 1
    Why not just use a `Servlet`? – Jens Jun 19 '17 at 19:10
  • 1
    Why do you want to run code without an output (HTML)? Anyway, you can look at https://adobe-consulting-services.github.io/acs-aem-tools/features/aem-fiddle/index.html to see how some fiddling can be done. AEM is not really designed to run just simple JSP. Like @Jens said, use a servlet instead. – Imran Saeed Jun 21 '17 at 12:07

1 Answers1

1

It is not possible to render a script directly in Sling. Hence, if you try to access one, you would either see the uncompiled JSP output or it would provide the JSP as a downloadable resource.

A more elaborate explanation for the same can be found at How to render a simple JSP page in CQ? and Adobe CQ - fetch HTML content from .jsp node

rakhi4110
  • 9,253
  • 2
  • 30
  • 49