开发者

Reference to all JSP files in web.xml

I have all the jsp files used by a webapp in a separate folder named jsp. I tried refere开发者_如何学编程nce 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>

**


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜