简体   繁体   English

WEB-INF可以位于JSP Tomcat6的子目录中吗

[英]Can WEB-INF be at a subdirectory JSP Tomcat6

I have an JSP application, it is under server/a/b and WEB-INF is under server/a/b/WEB-INF, not at the app-root directory. 我有一个JSP应用程序,它在server / a / b下,而WEB-INF在server / a / b / WEB-INF下,而不在app-root目录下。

Now I get an error saying the package P does not exisit when visiting server/a/b/index.jsp. 现在,我收到一个错误消息,说明在访问server / a / b / index.jsp时软件包P不存在。 Actually the package exists and it is at server/a/b/WEP-INF/classes/P/ 实际上,该软件包存在,并且位于server / a / b / WEP-INF / classes / P /

I want to know whether the error is due to not-at-root-directory? 我想知道错误是否是由于非根目录引起的吗?

Thanks! 谢谢!

Your server/a/b example is too ambiguous to reasonably answer the question. 您的server/a/b示例太含糊,无法合理地回答问题。

At least, it should be the immediate subdirectory of the webapplication context folder. 至少,它应该是Web应用程序上下文文件夹的直接子目录。 In Tomcat, all webapplications are to be placed in its own folder in the /tomcat/webapps folder where /tomcat is the Tomcat installation folder. 在Tomcat中,所有Web应用程序都应放置在/tomcat/webapps文件夹中其自己的文件夹中,其中/tomcat是Tomcat安装文件夹。 The /webapps folder should be already there when you installed Tomcat. 安装Tomcat时, /webapps文件夹应该已经存在。 Each deployed webapp should be placed in its own folder /webappname which contains the webapplication context which is to be reached by http://hostname:port/webappname . 每个部署的/webappname应用程序都应放置在其自己的文件夹/webappname ,该文件夹包含http:// hostname:port / webappname要访问的Web应用程序上下文

So, the /WEB-INF folder should be in /tomcat/webapps/webappname/WEB-INF . 因此, /WEB-INF文件夹应该位于/tomcat/webapps/webappname/WEB-INF Not anywhere else. 没有别的地方。 It would contradict the Servlet API specification . 这将与Servlet API规范相矛盾。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM