12.2.2. Displaying labels

12.2.2. Displaying labels

If you define your labels using the Seam resource bundle, you'll be able to use them without having to type <f:loadBundle ... /> on every page. Instead, you can simply type:

<h:outputText value="#{messages['Hello']}"/>

or:

<h:outputText value="#{messages.Hello}"/>

Even better, the messages themselves may contain EL expressions:

Hello=Hello, #{user.firstName} #{user.lastName}
Hello=G'day, #{user.firstName}

You can even use the messages in your code:

@In private Map<String, String> messages;
@In("#{messages['Hello']}") private String helloMessage;