简体   繁体   English

eclipse web.xml jsp配置

[英]eclipse web.xml jsp config

In an Eclipse JEE project with the Dynamic Web Module 3.0 facet enabled, I am developping a webapp fragment which consists in Java classes, JSP and other pages, which will then be deployed in a WAR. 在启用了Dynamic Web Module 3.0方面的Eclipse JEE项目中,我正在开发一个webapp片段,该片段由Java类,JSP和其他页面组成,然后将其部署在WAR中。 In this WAR's web.xml there's the following: 在此WAR的web.xml ,包含以下内容:

<jsp-config>
    <taglib>
        <taglib-uri>/tags/struts-tiles</taglib-uri>
        <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
    </taglib>
    [same for other taglibs, JSTL core etc.]
</jsp-config>

Which forces me to have at the beginning of my JSPs: 这迫使我在JSP的开始阶段必须具备以下条件:

<%@ taglib uri="/tags/struts-tiles" prefix="tiles"%>

But then, how do I tell Eclipse to take this jsp config into account? 但是,然后,我如何告诉Eclipse将这个jsp配置考虑在内? Right now it simply looks in the classpath, finds into standard.jar and struts.jar the tlds and sees the <uri> is wrong (for struts-tiles for example it's http://jakarta.apache.org/struts/tags-tiles and not /tags/struts-tiles ), and then the JSP parser Can not find the tag library descriptor for... . 现在,它只是在类路径中查找,找到tlds的standard.jarstruts.jar ,并发现<uri>是错误的(例如,对于struts-tiles,它是http://jakarta.apache.org/struts/tags-tiles而不是/tags/struts-tiles ),然后JSP解析器Can not find the tag library descriptor for...

If I paste the web.xml in my project's WEB-INF folder it seems to be ignored. 如果将web.xml粘贴到项目的WEB-INF文件夹中,似乎将被忽略。

Did you consider using web fragments (deployment descriptor fragments), which allow you to write modular "chunks" of web.xml configuration which will then can be combined by the container during development to form the entire application. 您是否考虑过使用Web片段(部署描述符片段),它允许您编写web.xml配置的模块化“块”,然后在开发过程中容器可以将其组合以形成整个应用程序。

Requirements : 要求 :

1) Each fragment must reside in its own JAR (typically along side the classes being configured that make up the application) inside the META-INF/web-fragment.xml file . 1)每个片段都必须位于META-INF / web-fragment.xml文件中的其自己的JAR(通常与构成应用程序的配置类一起)中。 (at most one!) (最多一个!)

2) The JAR file must be deployed to /WEB-INF/lib/ directory of the Web application. 2)必须将JAR文件部署到Web应用程序的/ WEB-INF / lib /目录中。

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

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