Solve the error that the formatnumber of jstl cannot accept the expression.

Source: Internet
Author: User

Jstl1.2.jar

Today, I encountered an error when using the <FMT: formatnumber> flag. My JSP page is written as follows:

<% @ Taglib uri = "http://java.sun.com/jstl/fmt" prefix = "FMT" %>, the markup is written as follows:

<FMT: formatnumber type = "Number"
Value = "$ {(flist. ADDR-(flist. ADDR % 10)/10}">
</FMT: formatnumber>

The following error is reported during running:

According to TLD or attribute directive in Tag file, attribute value does not accept any expressions.

You can still understand it. The general meaning is that the value attribute cannot accept expressions. Searching for information on the Internet is also confusing, so I ran to the jar package and checked the corresponding TLD file,

The original uri = "http://java.sun.com/jstl/fmt" written in the fmt-1_0.tld description, <tlib-version> 1.0 </tlib-version>, the choice is jstl1.0 version,

The formatnumber tag contains the following description:

<Tag-class> org. Apache. taglibs. Standard. Tag. El. FMT. formatnumbertag </Tag-class>

All the attribute descriptions are as follows:

<Rtexprvalue> false </rtexprvalue>

The El expression cannot be used.

However, although the fmt-1_0-rt.tld is the same as the tlib-version and JSP-version declared by the fmt-1_0, it uses a different tag-class:

<Tag-class> org. Apache. taglibs. Standard. Tag. RT. FMT. formatnumbertag </Tag-class>

The attribute Descriptions marked by this formatnumber contain the following sections:

<Rtexprvalue> true </rtexprvalue>

The El expression can be used, ^ _ ^.

In the JSP page, Uri is written as uri = "http://java.sun.com/jstl/fmt_rt ".

In addition, there is a FMT. TLD in jstl1.2.jar. <tlib-version> 1.1 </tlib-version> indicates that jstl1.1 is used.

On the JSP page, Uri is written as uri = http://java.sun.com/jsp/jstl/fmt. the valueiterator of formatnumbersupports elexpressions.

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/debbykindom/archive/2010/09/01/5854964.aspx

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.