Reputation: 772
I am trying to show an image in jsp, I am using the following code but it does not show the image, it just shows an image icon which indicates the link is broken.
When I put the file in the images folder it works but it does not find the file when its in logos folder.
the image is in this address Web pages \ images \ logos \ Tulips.jpg
and my code is as following
<%@taglib uri="/struts-tags" prefix="s"%>
....
<img src="<s:url value="/images/logos/Tulips.jpg"/>"/>
.....
People suggested me to use the following, I have added the following code and the dependancy but it shows the following error on the taglib line.
Unable to read TLD "META-INF/c.tld" from JAR file javaee-web-api.6.0.jar : org.apache.jasper.JasperException :PWC6169: Failed to load or instantiate TagLibraryValidator class:
org.apache.taglibs.standard.tlv.jstlCoreTLV
jsp
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<img src="<c:url value="/images/logos/Tulips.jpg"/>"/>
pom
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-parent</artifactId>
<version>3</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<type>jar</type>
</dependency>
Upvotes: 1
Views: 2081
Reputation: 11579
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<img src="<c:url value="/images/logos/Tulips.jpg"/>"/>
UPDATE
Also have a look at these links:
Error using JSF 2.1 with JSP 2.0: Unable to read TLD from JAR file
Unable to read TLD "META-INF/c.tld"
Upvotes: 4
Reputation: 19327
Can you try something like this also ?
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<img src="<html:rewrite page='/images/logos/Tulips.jpg/'>"/>
Upvotes: 0