Taglib cannot be recognized in Web. xml.

Source: Internet
Author: User
Tags tld
About web. X, which does not recognize <taglib> in Web. xml
The problem of unrecognized <taglib> In ipvs
Org. Apache. Jasper. jasperexception: the absolute URI: Http://java.sun.com/jstl/coreCannot be resolved in either web. xml or the jar files deployed with this application

The labels of my‑s5 can be directly used without declaring the <taglib> label in Web. xnl. This seems to be a feature of version 2.4.
However, on the JSP page
Must be added: <% @ taglib uri ="Http://java.sun.com/jsp/jstl/core"Prefix =" C "%>,
If the tag is not added, the tag is ignored and displayed as blank.
If the value is: <% @ taglib uri ="Http://java.sun.com/jsf/core"Prefix =" C "%>, an error is returned !!!!!
Why?
The reason is this !!!
If labels are used, jstl. Jar + standard. Jar should be placed in the lib directory of the project.
Decompress standard. jar and find the tag description file (many. TLD files) in the META-INF, and then open the TLD file to see the different URIs in it.
I undo C. TLD, see this sentence <URI> http://java.sun.com/jsp/jstl/core </uri>, this is the reason !!!!!

In short:
You can:
<% @ Taglib uri ="Http://java.sun.com/jsp/jstl/core"Prefix =" C "%>
No:
<% @ Taglib uri ="Http://java.sun.com/jsf/core"Prefix =" C "%>

Myeclips does not automatically add the <taglib> label in Web. xml. This is not a bug in myeclips. We can see that myecips is still very smart and we need to trust it.
If the *. TLD file is not in the WEB-INF, you need to write it in the format:
<JSP-config>
<Taglib>
<Taglib-Uri> http://java.sun.com/jsp/jstl/core </taglib-Uri>
<Taglib-location> token </taglib-location>
</Taglib>
</JSP-config>

The template is as follows:

======================================= Index. JSP ================================

<% @ Page Language = "Java" pageencoding = "gb18030" %>
<% @ Taglib uri ="Http://java.sun.com/jsp/jstl/core"Prefix =" C "%>

<! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en">
<HTML>
<Head>
<Title> my JSF 'index. jsp 'starting page </title>

<! --
<LINK rel = "stylesheet" type = "text/CSS" href = "styles.css">
-->

</Head>

<Body>
<C: foreach Var = "I" begin = "1" End = "30" step = "1">
<C: Out value = "$ {I}"/>
<Br/>
</C: foreach>
</Body>
</Html>

======================================== Web. xml =

<? XML version = "1.0" encoding = "UTF-8"?>
<Web-app version = "2.4" xmlns ="Http://java.sun.com/xml/ns/j2ee"
Xmlns: xsi ="Http://www.w3.org/2001/XMLSchema-instance"
Xsi: schemalocation ="Http://java.sun.com/xml/ns/j2ee
Http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
</Web-app>

-------------------------------------------------------------

I have written a custom tag library. In web. XML, I want to write a <taglib> ...... </Taglib>.
The syntax and format are correct, and the operation in Tomcat is normal. I developed it using myeclipse. In fact, Web. XML can have the taglib element, but myeclipse doesn't know ...... There is always a Red Fork that looks pretty bad. How can this problem be solved?
Responder 1:
Your jar package has not been loaded in. paste the reported Error
Responder 2:
What Web. XML are you loading? Is the header like this ???
<? XML version = "1.0" encoding = "UTF-8"?>
<Web-app version = "2.4"
Xmlns ="Http://JAVA.sun.com/xml/ns/j2ee"
Xmlns: xsi ="Http://www.w3.org/2001/xmlSchema-instance"
Xsi: schemalocation ="Http://JAVA.sun.com/xml/ns/j2ee
Http://JAVA.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
Responder 3:
Yes. This is the case for loading the tag library.
<JSP-config>
<Taglib>
<Taglib-Uri> XXXXX </taglib-Uri>
<Taglib-location> xxxxxxx </taglib-location>
</Taglib>
</JSP-config>
Responder 4:
Thank you, asclepios ()

Bytes --------------------------------------------------------------------------------------------------------------------------
You may encounter a Problem When configuring custom labels in Tomcat.

In web. XML, two versions of DTD authentication are available, one for Java 2.0 and the other for version. Therefore, different configurations are made for different versions.

Xsi: schemalocation ="Http://java.sun.com/xml/ns/j2ee Http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd

Version 2.0

Therefore, when adding your own taglib in Web. XML, you must include it in the middle of <JSP-config> </JSP-config>.

<JSP-config>
<Taglib>
<Taglib-Uri>/date </taglib-Uri>
<Taglib-location>/WEB-INF/date. TLD </taglib-location>
</Taglib>
</JSP-config

Bytes ---------------------------------------------------------------------------------------------------------------------------
<JSP-config> detailed description of tag usage
<JSP-config> includes two sub-elements: <taglib> and <JSP-property-group>.

The <taglib> element already exists in JSP 1.2, and <JSP-property-group> is a new element in JSP 2.0.
The <JSP-property-group> elements mainly have eight child elements:

1. <description>: Set description;
2. <display-Name>: Set the name;
3. <URL-pattern>: Set the range affected by the value, for example,/CH2 or/*. jsp;
4. <El-ignored>: if it is true, El syntax is not supported;
5. <Scripting-invalid>: if it is true, the <% scripting %> syntax is not supported;
6. <page-encoding>: sets the JSP page encoding;
7. <include-prelude>: Set the JSP page header with the extension. jspf;
8. <include-coda>: set the end of the JSP page with the extension. jspf.

Complete configuration of a simple <JSP-config> element:

<JSP-config>
<Taglib>
<Taglib-Uri> taglib </taglib-Uri>
<Taglib-location>/WEB-INF/TLDs/mytaglib. TLD </taglib-location>
</Taglib>
<JSP-property-group>
<Description> special property group for JSP configuration JSP Example. </description>
<Display-Name> jspconfiguration </display-Name>
<URL-pattern>/JSP/* </url-pattern>
<El-ignored> true </El-ignored>
<Page-encoding> gb2312 </page-encoding>
<Scripting-invalid> true </Scripting-invalid>
<Include-prelude>/include/Prelude. jspf </include-prelude>
<Include-coda>/include/coda. jspf </include-coda>
</JSP-property-group>
</JSP-config>

Taglib cannot be identified in ml

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.