Issue
I have all the jsp files used by a webapp in a separate folder named jsp. I tried reference all the jsp files in the web.xml by the following way. But doesn't work. What could be the problem?
**
<servlet>
<servlet-name>Jsps</servlet-name>
<jsp-file>/jsp/path/</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>Jsps</servlet-name>
<url-pattern>/*.jsp<url-pattern>
</servlet-mapping>
**
Solution
You cannot group jsps together under one servlet. If jsp is to be declared as a servlet, Each jsp should be defined as one servlet. For ex:
<servlet>
<servlet-name>Jsp1</servlet-name>
<jsp-file>/jsp/path/myjsp.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>Jsp1</servlet-name>
<url-pattern>/myjsp.jsp<url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Jsp2</servlet-name>
<jsp-file>/jsp/path/myjsp2.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>Jsp2</servlet-name>
<url-pattern>/myjsp2.jsp<url-pattern>
</servlet-mapping>
If your requirement if just to access jsps , you do not need any servlet definitions or servlet mappings. Access it directly using /jsp/path/myjsp.jsp path
Answered By - Ramesh PVK