JSTL Taglib -error - java

i have the following pice of code:
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
If i want to run the programm i get the following error message:
HTTP Status 500 - The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
My JAR Files are in the WEB-INF/lib/ folder
--->javax.servlet.jsp.jstl-1.2.1-javadoc.jar (IMP)
--->javax.servlet.jsp.jstl-api-1.2.1-javadoc.jar (API)
I use the WEB.xml Version 3.0
So please can someone help me?!
Thanks

It seems you have added the javadoc of the JSTL instead of the code. Try downloading this one and add it to your lib directory:
http://mvnrepository.com/artifact/javax.servlet/jstl/1.2

Related

Issue with uri of custom tag library

I have seen a weird problem while using custom tag libraries.
In one of my jsp pages the relative uri path of the custom tld file is wrong.
Taglib is included in jsp page like below
<%# taglib prefix="aaa" uri="WEB-INF/bbb.tld" %>
Location of bbb.tld is : Stores\WebContent\WEB-INF\bbb.tld
This taglib is included in a parent jsp file, and not there jsp file is imported/included from parent.
My application has several other jsp files, where the same taglib is used with the correct path.
The same code is deployed in multiple test environments. In a few environments the code is throwing an error of "Failed to find resource", which is expected. But the taglib is working fine in most of the environments, instead of wrong path.
Why is there discrepancy in the behavior between different server environments? Does the server automatically look for all tld files if the uri can't be resolved?
I would recommend adding a trailing slash ('/') before WEB-INF. Could you try the following?
<%# taglib prefix="aaa" uri="/WEB-INF/bbb.tld" %>
Hopefully, this will give you consistent results across all you server instances. Also, having your TLD in Stores\WebContent\WEB-INF\bbb.tld seems to be related to be using an IDE (e.g. Eclipse) to develop your application. Once you export your application as an EAR or WAR the path will look more like Stores.war/WEB-INF/bbb.tld

which jar to use for JSTL

(server Tomcat7v)
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
First Name:<c:out value="${param.fname}"></c:out><br/>
Last Name:<c:out value="${param.lname}"></c:out>
in the previous JSP and I am getting
Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"
this error.
But when I try to find out the jars there were lots of version of that I am confused with which one should I use??
You need to put jstl jar in your classpath. See details at https://stackoverflow.com/tags/jstl/info
I were using Tomcat 7v which uses servlet 3.0 so I had to use jstl1.2.1 jars

Setting file paths in eclipse projects?

In my JSP and servlets web app, I have this line in a TLD or XML file in eclipse - <%# taglib prefix="mine" uri="DiceFunctions"%> It gives me the error - Eclispe can not find
the tag library descriptor for "../DiceFunctions"
I know this has something to do with the path uri="DiceFunctions" in the above code.
How do I resolve this error ?
My project sturcture -
Have you create a taglib named 'mine' ?
you should read some doc about jsp taglib ;
The uri="DiceFunctions" is your taglib`s path

Spring adding Tags build error

I have got the following errors and i am unable to find an answer. Can someone help me here.
Description Resource Path Location Type
Can not find the tag library descriptor for "http://www.springframework.org/tags" contact.jsp /Spring3HibernateMaven/src/main/webapp/WEB-INF/jsp line 1 JSP Problem
Description Resource Path Location Type
Can not find the tag library descriptor for "http://www.springframework.org/tags/form" contact.jsp /Spring3HibernateMaven/src/main/webapp/WEB-INF/jsp line 2 JSP Problem
My JSP code is as follows;
<%# taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%# taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
In my Web.xml the code is as follows;
<jsp-config>
<taglib>
<taglib-uri>http://www.springframework.org/tags/form</taglib-uri>
<taglib-location>spring-form.tld</taglib-location>
</taglib>
</jsp-config>
How do i solve this error ?
You shouldn't need to configure the taglib in web.xml. Just make sure the org.springframework.web.servlet-xxx.jar is on your classpath (web-inf/lib). It contains the TLD files.
I have the same problem although I have already spring-webmvc-3.1.0.RELEASE.jar on Maven repos.
When I download jar org.springframework.web.servlet-3.1.0.RELEASE.jar and include in lib. It works.
I don't know why because two jars were totally the same, they just have different names.

Liferay Taglib import not working in JSP

I'm having trouble importing the liferay taglibs in one of my JSP pages, no idea what I'm doing wrong. I did the exact same thing in previous projects, but now for some reason it's not working.
My code to import:
<%# taglib uri="http://liferay.com/tld.ui" prefix="liferay-ui" %>
The syntax error I'm getting:
The absolute uri: http://liferay.com/tld.ui cannot be resolved in either web.xml or the jar files deployed with this application
I tried to google this problem quite extensively, but to no avail. The horrible documentation (or lack thereof) for liferay is also not a big help at all.
Thanks in advance for any help!
The taglib URI gets resolved from the following places(in the order):
If the container is Java EE platform compliant, the tag libraries that are part of the Java EE platform. This currently includes JSTL and JSF Tag Library libraries.
Taglib Map in web.xml, the web.xml can include an explicit map of URI's and TLD's respource paths.
TLDs in JAR files in WEB-INF/lib and TLDs under WEB-INF
TLD's supported by Container
In you case, check the following cases:
1) If jar file realted to liferay exists in WEB-INF/lib containing a TLD in jar/META-INF which will be defined with http://liferay.com/tld.ui URI.
2) If there is not jar file and the liferay-ui.tld exists outside the jar file, add the URI mapping entrey in your web.xml like below:
<taglib>
<taglib-uri>http://liferay.com/tld/ui</taglib-uri>
<taglib-location>/WEB-INF/tld/liferay-ui.tld</taglib-location>
</taglib>
it is not
<%# taglib uri="http://liferay.com/tld.ui" prefix="liferay-ui" %>
it should be
<%# taglib prefix="liferay-ui" uri="http://liferay.com/tld/ui" %>
notice that "tld.ui" must be "tld/ui".
liferay-ui.tld comes from util-taglib.jar that liferay adds to your WEB-INF/lib during hot deploy.
No entries to your web.xml are needed.
You probably need to include taglib declaration in your web.xml.
<taglib>
<taglib-uri>http://liferay.com/tld/ui</taglib-uri>
<taglib-location>/WEB-INF/tld/liferay-ui.tld</taglib-location>
</taglib>

Categories

Resources