Javaserver Pages





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
JSP Tutorial
Introduction Introduction
Installing JDK-Windows Installing JDK-Windows
Installing JDK-Linux Installing JDK-Linux
Installing Tomcat Installing Tomcat
Simple Program in JSP Simple Program in JSP
Pre-defined Variables Pre-defined Variables
Syntax of Tags Syntax of Tags
JSP Expression Language JSP Expression Language
JSP EL Operators JSP EL Operators
EL Implicit Variables EL Implicit Variables
Scopes Scopes
Using Arrays Using Arrays
Methods Methods
JSP Elements JSP Elements
Including Beans Including Beans
JSTL Tags JSTL Tags
Custom Tags Custom Tags
Session Session in JSP
Handling Cookies Handling Cookies
JSP Application Structure JSP Application Structure
Configuring web.xml Configuring web.xml
Tomcat Configuration Tomcat Configuration
JSP Examples JSP Examples
Forums Ask Your Doubts
Feedback Feedback
 




Internationalization Tag Library in JSP


Tutorials Jsp

Topic

What is Internationalization Tag Library in JSP?



Explanation

Internationalization Tag Library or 118N Tag library lists the tags that confirm the client locale settings for formatting and parsing client sensitive data like currency, date, etc in a locallized or customized manner. The following table lists all the tags that confirm to 118N standards and is used with a prefix "fmt".

Syntax:
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
Function
Tags Description
Setting Locale
setLocale,SetLocale tag is used set the linguistic conventions of a particular region
requestEncoding
requestEncoding tag is used to set character encoding.
Messaging
bundle,bundle tag is used to set the resource bundle for a given tag body,
message,Message tag allows you to retrieve text messages from a locale-specific resource bundle and display it on a JSP page.
setBundlesetBundle is to set the localization context in a variable .
Number andDate Formatting
formatNumber,formatNumber is used to convert a number using the java class instance
formatDateformatDate is used to convert a number using the java class instance
setTimeZone,
parseDate,
parseNumber
All these tags needs to specify the date, number explicitly to convert into an object.
Example:
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" 
    prefix="fmt" %>
    <p>Convert the number 14.3 with 4 decimal places</p>
    Formatting: <fmt:formatNumber value="123.4" type="NUMBER"  
    minFractionDigits="4" />
Result:
    Convert the number 14.3 to have 4 decimal places
    Formatting: 123.4000 

In the above example we have used the 118N tag to add "4" decimal places to the number given.

Example:
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
    <jsp:useBean id="dat" class="java.util.Date" />
    <fmt:formatDate value="${dat}" type="time" />
Result:
    1:44:40 PM

In the above we have used the "<:jsp:useBean/>" tag to include the java date class, using the format tag attribute "type" the time alone is displayed.






A Note
JSP(Java Server Pages) is one of the most used Server Side Programming Language in the world. Simple introduction, basic program codes with examples. Begin coding your own JSP scripts with this online tutorial. Hope you enjoy this tutorial. Do send your feedback or suggestions on this JavaServer Pages tutorial. This is a copyright content.


Other Links

web hosting