为什么< taglib>在我的web.xml中给我一个问题? [英] Why is <taglib> giving me a problem in my web.xml?

查看:73
本文介绍了为什么< taglib>在我的web.xml中给我一个问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个web.xml

I have this web.xml

<?xml version="1.0" encoding="UTF-8"?>
  <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
   <display-name>jsp-tags</display-name>
     <taglib>
       <taglib-uri>mytags</taglib-uri>
       <taglib-location>/WEB-INF/mytaglib.tld</taglib-location>
    </taglib>
    <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
   </welcome-file-list> 
</web-app>

突出显示,IDE给出的错误是:发现无效的内容,从元素...开始.

The is highlighted and the error the IDE gives is: "Invalid content was found starting with element ...

我还需要做什么?

推荐答案

使用此表示法:

<jsp-config> 
        <taglib> 
               <taglib-uri>mytags</taglib-uri> 
               <taglib-location>/WEB-INF/jsp/mytaglib.tld</taglib-location> 
        </taglib> 
</jsp-config>

但是我建议阅读此链接.本教程将使您了解如何避免在JSP 2.0的情况下在web.xml中声明标签库

But I recommended to read this link. This tutorial will give you idea how to avoid declaring taglibs in web.xml in case of JSP 2.0

这篇关于为什么&lt; taglib&gt;在我的web.xml中给我一个问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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