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.
精彩评论