wood burning stoves 2.0*
The moose likes JSP and the fly likes c:forEach, c:out are being ignored event though jar are present Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "c:forEach, c:out are being ignored event though jar are present" Watch "c:forEach, c:out are being ignored event though jar are present" New topic
Author

c:forEach, c:out are being ignored event though jar are present

Vineet Kumar Garg
Greenhorn

Joined: Apr 11, 2012
Posts: 21
I've placed following jars in WEB-INF\lib folder.

C:\Users\vgarg\work2\apache-tomcat-7.0.27\webapps\Beer-v1\WEB-INF\lib\jstl.jar
C:\Users\vgarg\work2\apache-tomcat-7.0.27\webapps\Beer-v1\WEB-INF\lib\standard.jar

in servlet I'm setting as below


in Jsp I've below code and I've verified using EL that values are reaching JSP.


Output being received:


After trying different things I reached the conclusion that c:forEach and and c:out tags are simply not working and the text is being displayed just once.

Any suggestions what's going wrong please?
Vineet Kumar Garg
Greenhorn

Joined: Apr 11, 2012
Posts: 21
(May be I should have posted the question an hour back itself as I found the solution after 5 minutes of posting it. :))

I found the problem. I didn't include the taglib in the JSP.



It solved the problem and everything is running good now.
Thanks
-Vineet
tsaowe cao
Greenhorn

Joined: Jul 14, 2011
Posts: 5

hi Vineet Kumar Garg

have you ever put this line under <html> ?
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>



when put this line in your jsp,you jsp file should like



<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<head>
<title>tsaowe</title>
</head>
<body>


when i put this, i got your expected result

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

tsaowe cao wrote:hi Vineet Kumar Garg have you ever put this line under <html> ?

Where the directive goes in relation to HTML markup is irrelevant. It's usually placed at the top of the file.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: c:forEach, c:out are being ignored event though jar are present
 
Similar Threads
Iterating <c:foreach> to get values from sublist
Jstl error
JSTL/EL Nested expression (within nested forEach) Issue
Doubt in Attribute with JSTL.Thanks!
Clarification for jstl <c:foreach> tag