简体   繁体   English

如何为我的自定义EL函数修复eclipse 4.3中的“找不到标签库描述符”

[英]How to fix “Can not find the tag library descriptor” in eclipse 4.3 for my custom EL function

setup: 设定:

eclipse 4.3 with tomcat7 (running on localhost port 8080) configured as my test server. Eclipse 4.3将tomcat7(在本地主机端口8080上运行)配置为我的测试服务器。

my EL class ( folder structure: http://i.imgur.com/ogOsCZM.jpg ) created using New => Java project in eclipse 我的EL类文件夹结构: http : //i.imgur.com/ogOsCZM.jpg )是使用eclipse中的New => Java项目创建的

package org.flinders.mycustomutilities;

//import java.lang.StringBuilder;

public class MyCustomUtilities {
    public static String Hello(String name) {
        return "Heya " + name;
    }

 }

The class was then exported into a JAR file and imported into my maven repository. 然后将该类导出到JAR文件中,然后导入到我的Maven存储库中。 It was then imported to my spring mvc project using this entry in pom.xml : 然后使用pom.xml中的此条目将其导入到我的spring mvc项目中

<dependency>
    <groupId>org.flinders.mycustomutilities</groupId>
    <artifactId>MyCustomUtilities</artifactId>
    <version>0.0.1</version>
</dependency>

I'm not getting any errors in Eclipse's Maven POM editor. 在Eclipse的Maven POM编辑器中没有出现任何错误。

my TLD file (stored in D:\\work\\eclipse\\java.metadata.plugins\\org.eclipse.wst.server.core\\tmp1\\wtpwebapps\\ROOT\\WEB-INF which seems to be the working folder for tomcat) 我的TLD文件 (存储在D:\\ work \\ eclipse \\ java.metadata.plugins \\ org.eclipse.wst.server.core \\ tmp1 \\ wtpwebapps \\ ROOT \\ WEB-INF中,这似乎是tomcat的工作文件夹)

<?xml version="1.0" encoding="UTF-8" ?>
<taglib
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
    version="2.1">

    <tlib-version>1.0</tlib-version>
    <short-name>mytaglib</short-name>
    <uri>org.flinders.mycustomutilities</uri>

    <function>
        <name>Hello</name>
        <function-class>org.flinders.mycustomutilities.MyCustomUtilities</function-class>
        <function-signature>java.util.String Hello(java.util.String)</function-signature>
    </function>
</taglib>

not really sure what to put in the URI tag for my setup. 我不太确定要为我的设置在URI标记中放入什么。

This is how I'm importing my custom EL function in my JSP file 这就是我在JSP文件中导入自定义EL函数的方式

<%@ taglib uri="WEB-INF/mytaglib.tld" prefix="mine" %>

I've also tried 我也尝试过

<%@ taglib uri="/WEB-INF/mytaglib.tld" prefix="mine" %>

but eclipse just can't see it. 但是蚀看不到它。 I have started tomcat via eclipse just in case that is required without any positive outcome. 我已经通过Eclipse开始了tomcat,以防万一需要而没有任何积极的结果。 Still getting the error mentioned above. 仍然遇到上述错误。

Any ideas? 有任何想法吗? I've been searching for examples on the net but they don't really give complete/working examples. 我一直在网上搜索示例,但实际上并没有提供完整的示例。

thanks! 谢谢!

My problem is that I was placing the tld file in the wrong place. 我的问题是我将tld文件放在错误的位置。 I am importing the class/jar into my spring web mvc project. 我正在将class / jar导入到我的spring web mvc项目中。 But I was putting the TLD file in the "ROOT" WEB-INF. 但是我将TLD文件放在“ ROOT” WEB-INF中。 I should've placed it in the WEB-INF for my web project. 我应该将其放在Web项目的WEB-INF中。 All working now thanks to all those who looked at it. 现在所有人都在工作,感谢所有关注它的人。

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

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