You cannot render a JSP directly in CQ5 as Sling renders only the content/resource and not the scripts.
As a quix fix you can create an nt:unstructured
node with the sling:resourceType
property set to the path of the jsp (something like below)
list: {
sling:resourceType: "/apps/myapp/views/list.jsp",
jcr:primaryType: "nt:unstructured"
},
view: {
sling:resourceType: "/apps/myapp/views/view.jsp",
jcr:primaryType: "nt:unstructured"
}
and then call these paths in your AJAX requests.
But then, it is not recommended to point directly to scripts, as @BertrandDelacretaz rightly points out. Instead you can have components that can service your requests. If there are too many components to create then you can have a single component service your requests with the help of selectors.
For e.g., your component structure can be like the one shown below.
/apps/myapp/views
|_ list.jsp
|_ view.jsp
|_ anythingelse.jsp
And the resource( say /content/myapp/views
) will now have the sling:resourceType
as /apps/myapp/views
.
And your AJAX requests would be
/content/myapp/views.list.html
/content/myapp/views.view.html
/content/myapp/views.anythingelse.html