saurabh kumar
saurabh kumar

Reputation: 53

internatiolization in jsp using fmt tag

    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
    <html>
    <head>
    <title>JSTL fmt:message Tag</title>
    </head>
    <body>

    <fmt:setLocale value="en"/>
    <fmt:setBundle basename="com.tutorialspoint.Example" var="lang"/>

    <fmt:message key="count.one" bundle="${lang}"/><br/>
    <fmt:message key="count.two" bundle="${lang}"/><br/>
    <fmt:message key="count.three" bundle="${lang}"/><br/>

    </body>
    </html>

i am using here fmt tag of jstl which is showing this output. ???count.one??? ???count.two??? ???count.three???

Upvotes: 0

Views: 282

Answers (1)

Runcorn
Runcorn

Reputation: 5224

Do you have the associated properties file in the bundle you have mentioned

<fmt:setBundle basename="com.tutorialspoint.Example" var="lang"/>

If not, you need to have a properties file in com > tutorialspoint named tutorialspoint.properties which should contain,

count.one=one  
count.two=two  
count.three=three

And, for different setLocale like fr you should use tutorialspoint_fr.properties and so on.

Upvotes: 1

Related Questions