?
Solved

JSTL example error

Posted on 2012-08-10
7
Medium Priority
?
764 Views
Last Modified: 2012-08-14
Hi,

I was trying following JSTL example after downloaded JSTL jar and exractin and keeping tlds under WEB-INF/tld directory.

When I run the application it is throwing error as in attachment. Please advise on fixing it.

Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
<%@ taglib prefix="c" uri="/WEB-INF/tld/c.tld"%>
<%@ taglib prefix="sql" uri="/WEB-INF/tld/sql.tld"%>
Setting the value:
<b>Hello World! </b>
in a variable named
<b>hello</b>
<c:set var="hello" value="Hello World!" />
<br />
The value in
<b>hello</b>
variable is :
<c:out value="${hello}" />
<%
      java.util.List list = new java.util.ArrayList();
      list.add("Hello");
      list.add("Welcome");
      list.add("JSTL");
      pageContext.setAttribute("list", list);
%>
<br />
Following are the names in a collection.
<br />
<c:forEach var="name" items="${list}">
      <c:out value="${name}" />
      <br />
</c:forEach>
<br>
Following is a demo of c:choose tag
<br />
<c:set var="test" value="Hello" />
<c:choose>
      <c:when test="${test=='Hello'}">
            <c:out value="The value is Hello" />
      </c:when>
      <c:otherwise>
            <c:out value="The value is not Hello" />
      </c:otherwise>
</c:choose>
JSTLError2.JPG
0
Comment
Question by:gudii9
  • 5
  • 2
7 Comments
 
LVL 28

Accepted Solution

by:
rrz earned 2000 total points
ID: 38282589
>after downloaded JSTL jar  
Which jar did you download ? From where?
>exractin and keeping tlds under WEB-INF/tld directory.  
No, don't do that. Just put the jars in your library(which will end up in the lib folder on the server). The web server will find the tlds.
0
 
LVL 7

Author Comment

by:gudii9
ID: 38287833
I kept all the TLD files at attached highlighted location under WEB-INF/tld
TLDFiles.JPG
0
 
LVL 7

Author Comment

by:gudii9
ID: 38288067
what jar i need to keep under WEB-INF/lib directory. Please advise
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Author Comment

by:gudii9
ID: 38293372
I have been going through following link

http://www.tutorialspoint.com/jsp/jsp_standard_tag_library.htm

they mentioned either I can keep jar file under web-inf/lib or put all tld files as well at tld folder. Still not working. Please advise
0
 
LVL 7

Author Comment

by:gudii9
ID: 38293402
where can I download the jar file to include. I could not find jar in above link also. Please advise
0
 
LVL 7

Author Comment

by:gudii9
ID: 38293880
I found the JARS at link

http://www.java2s.com/Code/Java/JSTL/JSTLConditionalSupportSimpleConditionalExecutionExample.htm

after copying to webinf/lib and putting tld working fine
JSTLWorking.JPG
0
 
LVL 28

Expert Comment

by:rrz
ID: 38294727
I am sorry. I was away from my desktop for a few days.  
Do you need any help ?
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month13 days, 12 hours left to enroll

755 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question