开发者

How to use f:loadbundle with facelets

开发者 https://www.devze.com 2023-04-06 18:22 出处:网络
Using f:loadbundle when using jsp as the view开发者_运维技巧 description language for an JSF application is pretty straight forward.

Using f:loadbundle when using jsp as the view开发者_运维技巧 description language for an JSF application is pretty straight forward.

I want to know where to put this f:loadbundle when i am using facelets


Except from the way the taglibs are declared, it's really not different from JSP.

<!DOCTYPE html>
<html lang="en"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets">
    <f:loadBundle basename="com.example.i18n.text" var="text" />
    <head>
        <title>Facelets page</title>
    </head>
    <body>
        <h:outputText value="#{text['some.key']}" />
    </body>  
</html>

This also applies to all other tags/components. The only major difference is that you need to declare the taglib in a XML namespace instead of an old fashioned JSP <%@taglib %> thingy.

0

精彩评论

暂无评论...
验证码 换一张
取 消