Weblogic中的JSTL支持 [英] JSTL support in Weblogic

查看:365
本文介绍了Weblogic中的JSTL支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用Weblogic开始使用Java EE,并且我无法使JSTL标记工作,在最简单的代码中,我在部署应用程序时遇到以下错误:

Im trying to start working with Java EE using Weblogic, and i cant make JSTL tags work, in simpliest code i get the following errors when deploying my application:


index.jsp:1:4:使用此URI找不到标签库
。可能的原因
可能是URI不正确,或
解析.tld文件的
时出错。 <%@ taglib prefix =c
uri =http://java.sun.com/jsp/jstl/core%>

index.jsp:1:4: No tag library could be found with this URI. Possible causes could be that the URI is incorrect, or that there were errors during parsing of the .tld file. <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

^ ---- ^ index.jsp:1:4:没有标签
可以使用此URI找到库。
可能的原因可能是URI
不正确,或者在解析.tld
文件时有
错误。 <%@ taglib prefix =c
uri =http://java.sun.com/jsp/jstl/core%>

^----^ index.jsp:1:4: No tag library could be found with this URI. Possible causes could be that the URI is incorrect, or that there were errors during parsing of the .tld file. <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

^ ---- ^ index.jsp:2:4:没有标签
可以使用此URI找到库。
可能的原因可能是URI
不正确,或者在解析.tld
文件时有
错误。 <%@ taglib prefix =sql
uri =http://java.sun.com/jsp/jstl/sql%>

^----^ index.jsp:2:4: No tag library could be found with this URI. Possible causes could be that the URI is incorrect, or that there were errors during parsing of the .tld file. <%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>

^ ---- ^ index.jsp:2:4:没有标签
可以使用此URI找到库。
可能的原因可能是URI
不正确,或者在解析.tld
文件时有
错误。 <%@ taglib prefix =sql
uri =http://java.sun.com/jsp/jstl/sql%>

^----^ index.jsp:2:4: No tag library could be found with this URI. Possible causes could be that the URI is incorrect, or that there were errors during parsing of the .tld file. <%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>

我从这个网站下载了taglib文件: http:// archive.apache.org/dist/jakarta/taglibs/standard/
并将两个罐子(standard.jar和jstl.jar)放在我的WEB-INF目录下。我还把arcihve中的所有tld文件放在那里。
我尝试在我的web.xml文件中引用它们并且在验证之后我得到以下错误:

I downloaded taglib files from this website: http://archive.apache.org/dist/jakarta/taglibs/standard/ and put two jars(standard.jar and jstl.jar) under my WEB-INF directory. I also put there all the tld files from the arcihve. Ater that i tried referencing them in my web.xml file and after validation i get the following error:


XML验证已启动。检查
文件:/ C:/Users/Brodyaga/Documents/NetBeansProjects/Eshop1/web/WEB-INF/web.xml ...
参考实体at
nbres:/ org /的netbeans /模块/ J2EE / ddloaders /目录/资源/ XMLSchema.dtd。
参考实体
nbres:/org/netbeans/modules/j2ee/ddloaders/catalog/resources/datatypes.dtd。
cvc-complex-type.2.4.a:从
元素'taglib'开始,找到无效的
内容。其中一个
'{http://java.sun.com/xml/ns/javaee\":description,
http://java.sun.com/xml/ns/javaee: display-name,
http://java.sun.com/xml/ns/javaee\":icon,
http://java.sun.com/xml/ns/javaee:可分发的,
http://java.sun.com/xml/ns/javaee\":context-param,
http://java.sun.com/xml/ns/javaee:过滤器,
http://java.sun.com/xml/ns/javaee\":filter-mapping,
http://java.sun.com/xml/ns/javaee:听众,
http://java.sun.com/xml/ns/javaee\":servlet,
http://java.sun.com/xml/ns/javaee\":servlet-映射,
http://java.sun.com/xml/ns/javaee\":session-config,
http://java.sun.com/xml/ns/javaee: mime-mapping,
http://java.sun.com/xml/ns/javaee\":welcome-file-list,
http://java.sun.com/xml/ns / javaee:error-page,
http://java.sun.com/xml/ns/javaee\":jsp-config,
http://java.sun.com/xml / ns / javaee:security-constraint,
http://java.sun.com/xml/ns/javaee\":login-config,
http://java.sun.com / xml / ns / javaee:security-role,
http://java.sun.com/xml/ns/javaee\":env-entry,
http://java.sun .com / xml / ns / javaee:ejb-ref,
http://java.sun.com/xml/ns/javaee\":ejb-local-ref,
http:/ /java.sun.com/xml/ns/javaee\":service-ref,
http://java.sun.com/xml/ns/javaee\":resource-ref,
http ://java.sun.com/xml/ns/javaee:resource-env-ref,
http://java.sun.com/xml/ns/javaee\":message-destination-ref,
http://java.sun.com/xml/ns/javaee\":persistence-context-ref,
http://java.sun.com/xml/ns/javaee: persistence-unit-ref,
http://java.sun.com/xml/ns/javaee\":post-construct,
http://java.sun.com/xml/ns / javaee:pre-destroy,
http://java.sun.com/xml/ns/javaee\":message-destination,
http://java.sun.com/xml / ns / javaee:locale-encoding-mapping-list}'
是预期的。 [12] XML验证
完成。

XML validation started. Checking file:/C:/Users/Brodyaga/Documents/NetBeansProjects/Eshop1/web/WEB-INF/web.xml... Referenced entity at "nbres:/org/netbeans/modules/j2ee/ddloaders/catalog/resources/XMLSchema.dtd". Referenced entity at "nbres:/org/netbeans/modules/j2ee/ddloaders/catalog/resources/datatypes.dtd". cvc-complex-type.2.4.a: Invalid content was found starting with element 'taglib'. One of '{"http://java.sun.com/xml/ns/javaee":description, "http://java.sun.com/xml/ns/javaee":display-name, "http://java.sun.com/xml/ns/javaee":icon, "http://java.sun.com/xml/ns/javaee":distributable, "http://java.sun.com/xml/ns/javaee":context-param, "http://java.sun.com/xml/ns/javaee":filter, "http://java.sun.com/xml/ns/javaee":filter-mapping, "http://java.sun.com/xml/ns/javaee":listener, "http://java.sun.com/xml/ns/javaee":servlet, "http://java.sun.com/xml/ns/javaee":servlet-mapping, "http://java.sun.com/xml/ns/javaee":session-config, "http://java.sun.com/xml/ns/javaee":mime-mapping, "http://java.sun.com/xml/ns/javaee":welcome-file-list, "http://java.sun.com/xml/ns/javaee":error-page, "http://java.sun.com/xml/ns/javaee":jsp-config, "http://java.sun.com/xml/ns/javaee":security-constraint, "http://java.sun.com/xml/ns/javaee":login-config, "http://java.sun.com/xml/ns/javaee":security-role, "http://java.sun.com/xml/ns/javaee":env-entry, "http://java.sun.com/xml/ns/javaee":ejb-ref, "http://java.sun.com/xml/ns/javaee":ejb-local-ref, "http://java.sun.com/xml/ns/javaee":service-ref, "http://java.sun.com/xml/ns/javaee":resource-ref, "http://java.sun.com/xml/ns/javaee":resource-env-ref, "http://java.sun.com/xml/ns/javaee":message-destination-ref, "http://java.sun.com/xml/ns/javaee":persistence-context-ref, "http://java.sun.com/xml/ns/javaee":persistence-unit-ref, "http://java.sun.com/xml/ns/javaee":post-construct, "http://java.sun.com/xml/ns/javaee":pre-destroy, "http://java.sun.com/xml/ns/javaee":message-destination, "http://java.sun.com/xml/ns/javaee":locale-encoding-mapping-list}' is expected. [12] XML validation finished.

我的web.xml如下:

My web.xml goes as following:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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-app_2_5.xsd">
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
        <taglib-location>/WEB-INF/fmt.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>
        <taglib-location>/WEB-INF/fmt-rt.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
        <taglib-location>/WEB-INF/c.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
        <taglib-location>/WEB-INF/c-rt.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
        <taglib-location>/WEB-INF/sql.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri>
        <taglib-location>/WEB-INF/sql-rt.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
        <taglib-location>/WEB-INF/x.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri>
        <taglib-location>/WEB-INF/x-rt.tld</taglib-location>
    </taglib>
</web-app>

我相信在web.xml开头指定的xml架构不允许taglib标签,但我有不知道我应该使用什么模式。

I believe that xml schema specified in the beginning of web.xml doesnt allow taglib tags, but i have no idea what schema i should use.

我真的很感激为weblogic添加jstl支持的一步一步的教程。在此先感谢。

I'd really apprectiate some step by step tutorial for adding jstl support to weblogic. Thanks in advance.

更新
从web.xml中删除那些< taglib>会以及如下所示的错误:

UPDATE Removing those <taglib>'s from web.xml ends up with erros such as following:


index.jsp:18:14:找不到标签处理程序类

org.apache .taglibs.standard.tag.rt.core.ForEachTag。

index.jsp:18:14: The tag handler class was not found "org.apache.taglibs.standard.tag.rt.core.ForEachTag".

以及c.tld文件的内容清楚地表明weblogic知道forEach对应于org.apache.taglibs .standard.tag.rt.core.ForEachTag,但无法找到该课程。但我可以在standard.jar中手动找到这个类。

and by the contents of c.tld file its clear that weblogic understands that forEach corresponds to org.apache.taglibs.standard.tag.rt.core.ForEachTag, but cant find the class. But i can manually find this class in standard.jar.

推荐答案

你必须在WEB-INF / lib文件夹中包含jstl.jar和standard.jar,而不是在WEB中-INF文件夹。我想这可以解决这个问题。

You have to include both jstl.jar and standard.jar in the WEB-INF/lib folder, not in the WEB-INF folder. I guess that will solve this problem.

这篇关于Weblogic中的JSTL支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆