Hi Junior Apache Sling is a resource based framework. You create a content node such as a web page (usually as JCR node in a JCR repository) with a property sling:resourceType that is mapped to a location of your scripts and other content properties that maybe specific to your application requirements.The URL you call is a URL to that resource. The framework then uses the resource type and information in the URL (like selectors and extension) to map it to a script (or servlet) that knows how to render it. This is how sling separates content from code that renders it. You could map a Servlet deployed as OSGi service to a specific URL. But I don’t consider that good practice.
See Sling documentation for derails on how resource resolution works. https://sling.apache.org/documentation/the-sling-engine/url-to-script-resolution.html <https://sling.apache.org/documentation/the-sling-engine/url-to-script-resolution.html> https://sling.apache.org/documentation/the-sling-engine/servlets.html <https://sling.apache.org/documentation/the-sling-engine/servlets.html> I hope this helps. Henry > On Aug 9, 2016, at 6:55 AM, Júnior <fjunio...@gmail.com> wrote: > > Hi Jason, > > Thanks for you reply. > > By "calling directly" I mean to be processed as it was being called in a > web container. So the scriptlets and tags would be processed. > > As I understood it correctly, I would need to have a servlet or component > that would be responsible for calling that JSP, right? > > Thanks > > > 2016-08-09 10:50 GMT-03:00 Jason Bailey <jason.bai...@sas.com>: > >> This really depends on what you mean by 'calling directly' >> >> if you put a jsp file under the /apps directory. You are putting a file >> there. You can access that file directly as a file. If you are looking at >> accessing the functionality that the jsp provides, the servlet, you need >> to point to something that says >> >> 1. compile that jsp over there that the meta data is aware of into a >> servlet >> 2. pass the arguments from the called object into that servlet >> >> That's the whole basis of the sling design with the separation of logic >> and content that represents that logic. If you feel really compelled to do >> something where you want to put a jsp and then be able to call that as >> servlet from the location you put it, in my understanding, that would be a >> custom implementation where you would need to create your own extension or >> selector so that when you requested the jsp file it would be handled in the >> manner that you want. >> >> -Jason >> >> ________________________________________ >> From: Júnior <fjunio...@gmail.com> >> Sent: Tuesday, August 9, 2016 9:10 AM >> To: users@sling.apache.org >> Subject: Call JSP Directly on Apache Sling >> >> Hi, >> >> Is there any way to call a JSP directly on Apache Sling? >> >> I'd like to call a JSP that is deployed on Apache Sling. >> >> Any tips are welcome. >> >> Thanks >> -- >> Francisco Ribeiro >> *SCEA|SCJP|SCWCD|IBM Certified SOA Associate* >> > > > > -- > Francisco Ribeiro > *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*