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

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Use of fn:toUpperCase(String) and fn:toLowerCase(String) Tag of JSTL 
 

In this section we will learn use and Tag of JSTL.

 

Use of fn:toUpperCase(String) and fn:toLowerCase(String) Tag of JSTL

                         

In this section we will learn how to use <fn:toUpperCase> and  <fn:toLowerCase> Tag of JSTL. These tags are used to change case of specified string to upper or lower. This takes string type as argument.

Syntax :
java.lang.String toLowerCase(java.lang.String)

java.lang.String toUpperCase(java.lang.String)







changeCase_fnJstlTag.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
    <head>
        <title>Example of 'fn:toUpperCase' and 'fn:toLowerCase' tag of jstl</title>
    </head>
    <body>
        <form method="POST">
            Enter String here and select case as per your choice.
            <table>              
                <tr>
                    <td>Enter String</td>
                    <td><input type="text" name="string"></td>
                </tr>               
                <tr>
                    <td></td>
                    <td><input type="radio" name="case" value="upper"> Upper Case
                    <input type="radio" name="case" value="lower"> Lower Case  </td>
                </tr>            
                <tr>
                    <td></td>
                    <td><input type="submit" value="change"></td>
                </tr>
            </table>  
        </form>
        <c:if test="${pageContext.request.method=='POST'}">            
            <c:set var="string" value="${param.string}"/>
            <font size="5" color="green">
                <c:if test="${param.case=='upper'}">

                    <c:out value="${fn:toUpperCase(string)}"/>

                </c:if>
                <c:if test="${param.case=='lower'}">

                    <c:out value="${fn:toLowerCase(string)}"/>

                </font>
            </c:if>
        </c:if>
    </body>
</html>

 

This jsp code shows the following output :



Suppose user enter string 'Mahendra Singh' as the given below and select 'Upper Case' radio button....


              
when user click on change button. Output will be.....

             

 

Download Source Code

                         

» View all related tutorials
Related Tags: java c oop jsp io user word loop iteration ip page numbers key value number state this ai oo js

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.