在预期路径中未找到片段(eclipse jsp)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/263730/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 13:23:20  来源:igfitidea点击:

fragment was not found at expected path (eclipse jsp)

eclipsetagfilevalidationerror

提问by joshjdevl

In eclipse, I have a javaproject (not a web project), though it does provide reusable tag files.

在 eclipse 中,我有一个 javaproject(不是 web 项目),但它确实提供了可重用的标记文件。

layout

布局

+src
+++META-INF
----my.tld
+++++++++++tags
---------------include.jsp

+src
+++META-INF
----my.tld
+++++++++++tags
---------------include.jsp

I keep on getting Fragment "/META-INF/tags/include.jsp" was not be found at expected path /Project/META-INF/tags/taginclude.jsp

我不断收到片段“/META-INF/tags/include.jsp”未在预期路径/Project/META-INF/tags/taginclude.jsp

How can I modify the path eclipse is looking for? I need to tell it to include "src" in the lookup

如何修改eclipse正在寻找的路径?我需要告诉它在查找中包含“src”

回答by

Josh, if you're working with .jsp and .tld files, then you really shouldn't be doing this as a "Java Project", but instead a "Dynamic Web Project" in Eclipse. Nonetheless, I'll try to answer your question.

Josh,如果您正在使用 .jsp 和 .tld 文件,那么您真的不应该将其作为“Java 项目”来执行,而应该作为 Eclipse 中的“动态 Web 项目”来执行。尽管如此,我会尽量回答你的问题。

Based on the diagram of your file system, your files are laid out incorrectly. If you're trying to create a web app (a .war file), then you need a WEB-INF directory. Under the WEB-INF directory you'll need a web.xml file (google for web.xml to see what needs to be in there), a tags directory, and a classes and lib directory.

根据您的文件系统图,您的文件布局不正确。如果您正在尝试创建一个 Web 应用程序(一个 .war 文件),那么您需要一个 WEB-INF 目录。在 WEB-INF 目录下,您需要一个 web.xml 文件(google for web.xml 以查看其中需要什么)、一个标签目录以及一个 classes 和 lib 目录。

Compiled class files must go in the WEB-INF/classes directory. Jar files that you depend on must go in the WEB-INF/lib directory. Tablibs must go in the WEB-INF/tags directory. Finally, your .jsp files must go in src directory (the parent dir of WEB-INF).

编译后的类文件必须放在 WEB-INF/classes 目录中。您依赖的 Jar 文件必须放在 WEB-INF/lib 目录中。Tablib 必须放在 WEB-INF/tags 目录中。最后,您的 .jsp 文件必须位于 src 目录(WEB-INF 的父目录)中。

So, your layout should look like this:

所以,你的布局应该是这样的:

myproject/
`-- src
    |-- WEB-INF
    |   |-- classes
    |   |   `-- MyClass.class
    |   |-- lib
    |   |   `-- my.jar
    |   |-- tags
    |   |   `-- my.tld
    |   `-- web.xml
    `-- include.jsp

Hope this helps.

希望这可以帮助。

-Bryan

-布莱恩

回答by nitind

I'm afraid I don't understand the ascii representation in the original post, but the validator can make use of any project with a ModuleCore Nature and its .settings/org.eclipse.wst.common.component file to find out what "/" means. Creating a Dynamic Web Project and inspecting that file and .project might help you piece together the right contents to make this work in your Java project.

恐怕我不理解原始帖子中的 ascii 表示,但是验证器可以利用任何具有 ModuleCore Nature 及其 .settings/org.eclipse.wst.common.component 文件的项目来找出“ /“ 方法。创建一个动态 Web 项目并检查该文件和 .project 可能会帮助您将正确的内容拼凑起来,从而在您的 Java 项目中进行这项工作。

回答by zhiwen zhang

Maybe the path of the jsp page is incorrect!You can check it using ctrl+left click,if can't open the jsp file,I suggest you check the path.

可能是jsp页面的路径不对!可以ctrl+左键查看,如果打不开jsp文件,建议查看路径。