Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Use of Tag of JSTL 
 

In this section, will learn how to use Tag of JSTL.

 

Use of <fn:length(String)> Tag of JSTL

                         

In this section we will learn how to use <fn:length> Tag of JSTL. This tag returns the number of items in a collection, or the number of characters in a string. This takes Object type as arguments and returns int type.

Syntax :
int length(java.lang.Object)









length_fnJstlTag.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
    <head>
        <title>Example of fn:length tag of JSTL</title>
    </head>
    <body>
        <form method="POST">
            This will calculate the length of specified string.
            <table>
                <tr>
                    <td>Enter String</td>
                    <td><input type="text" name="text"></td>
                </tr>
                
                <tr>
                    <td></td>
                    <td><input type="submit" value="calculate"></td>
                </tr>
            </table>  
        </form>
        <c:if test="${pageContext.request.method=='POST'}">
            <c:set var="text" value="${param.text}"/>
            
            <font size="5" color="#1B2A0A">
                Length : 
            </font>
            <font size="5" color="green">

                <c:out value="${fn:length(text)}"/>
                
            </font>
        </c:if>
    </body>
</html>


This jsp code shows the following output :



Suppose in user wants to calculate the length of string 'mahendra singh'.....



When user clicks on calculate button, output will be.....



Download Source Code

                         

» View all related tutorials
Related Tags: jsp div io sed vi rmi number visio opera ai js to division modulus e main use ul pe in

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.