[JSP] [JSTL] Page Call function--it ${FN:} built-in function, is inferred that the string is empty, replace the carriage

Source: Internet
Author: User

Call function in Page--${FN:} Built-in function


Descriptive description of function

  • Fn:contains (string, substring) assumes that the number of parameters in the string includes the substring, which returns true
  • Fn:containsignorecase (string, substring) assumes that the reference string includes the parameter substring (ignoring uppercase and lowercase) and returns true
  • Fn:endswith (string, suffix) assumes that the parameter string ends with a reference of suffix and returns true
  • Fn:escapexml (String) translates the XML (and HTML) with special meaning into the corresponding XML character entity code, and returns
  • Fn:indexof (string, substring) returns the position of the first occurrence of the parameter substring in the parameters string
  • Fn:join (array, separator) strings a given array of arrays together with the given spacer separator, forming a new string and returning it.
  • Fn:length (item) returns the number of elements included in the parameter item. The parameter item type is an array, a collection, or a string.

    Assumes a string type, and the return value is the number of characters in string.

  • Fn:replace (String, before, after) returns a String object.

    Replaces all occurrences of the before string in the parameter string with the after string, and returns the replaced result

  • Fn:split (string, separator) returns an array with the number of parameters separator as the cut-off string. Each part of the cut is an element of the array
  • Fn:startswith (string, prefix) assumes that the parameter string starts with the number of references, and returns True, prefix
  • Fn:substring (string, begin, end) returns the reference string part string, starting at the start of the reference to the parameter end position, including the character of the end position
  • Fn:substringafter (string, substring) returns the portion of the string that follows the substring in the parameter string
  • Fn:substringbefore (string, substring) returns the part of the string that precedes the parameter substring in the parameter string
  • Fn:tolowercase (string) turns all the characters in the string to lowercase and returns
  • Fn:touppercase (String) capitalizes all characters of the reference string and returns it
  • Fn:trim (string) removes whitespace from the end of the parameter string. and return it to
To illustrate:

<c:choose>    <c:when test= "${fn:length (audit_message) >0}" >        <c:foreach var= "message" items = "${audit_message}" >            <li>                <span>                    <strong> ${message.title}</strong>                </span>            </li>        </c:forEach>        <c:if test= "${audit_message_more}" >    <li >        <div class= "desc clearfix" >     <a href= "<%=basepath%>manage/message/list.action" > Many other >></a> </div>            </li></c:if>    </c:when>    <c:otherwise>            </c:otherwise></c:choose>


Jstl inferred if the character is empty

    1. <c:when test="${not Empty Alloweduploadimageextension}">

Replace carriage return:<span> in the display contains carriage return is not carriage return, all often need to replace the carriage return to <br> ability normal display return effect.

Error: ${fn:replace (source, ' \ n ', ' <br> ')} This method will cause an error.

Correct:<% request.setattribute ("VEnter", "\ n"); %>

${fn:replace (source, VEnter, "<br>")


Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

[JSP] [JSTL] Page Call function--it ${FN:} built-in function, is inferred that the string is empty, replace the carriage

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.