The foreach tag of the JSTL expression executes only the loop does not show the value taken out

Source: Internet
Author: User

Jstl of the use of foreach tags online a large number of, not to mention here, this time the main mark is why according to the normal notation does not show the value, ${value} put that what kind of show what kind of

The title effect is described as follows:

In the JSP:

<c:foreach begin= "1" var= "a" end= "5" step= "1" >
${a} <br>
</c:forEach>

Display effect:

${a}
${a}
${a}
${a}
${a}

Jstl References:
<%@ taglib uri= "Http://java.sun.com/jsp/jstl/core" prefix= "C"%>

Maven Engineering Pom File Reference package:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>

Zocha Right one afternoon the final conclusion is that the Web. xml file was originally automatically generated and does not match the JSTL version

Bad use of Web. XML (head part):
<! DOCTYPE Web-app Public
"-//sun Microsystems, INC.//DTD Web application 2.3//en"
"Http://java.sun.com/dtd/web-app_2_3.dtd" >

Modified to:

<?xml version= "1.0" encoding= "UTF-8"?>

<web-app version= "2.5"
Xmlns= "Http://java.sun.com/xml/ns/javaee"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
Xsi:schemalocation= "Http://java.sun.com/xml/ns/javaee
Http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd ">

~~~~~~~~~~~~~~

<web-app>

(PS: The first time this thing, don't maitai me)

The foreach label of the

Jstl expression only performs a loop that does not show the value taken out

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.