繁体   English   中英

使用fmt标签在jsp中进行内部化

[英]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>

我在这里使用jstl的fmt标签显示此输出。 ??? ??? count.one ??? ??? count.two ??? ??? count.three

您提到的捆绑软件中是否有关联的属性文件

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

如果没有,则需要在com> tutorialspoint中有一个名为tutorialspoint.properties的属性文件,该文件应包含,

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

而且,对于像fr这样的不同setLocale您应该使用tutorialspoint_fr.properties等。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM