h:outputText |
|
The outputText tag renders basic text on your JSF page. You can customize
the appearance of the text using CSS styles, in which case the generated text is
wrapped in an HTML span element. You can also escape the rendered text if it
contains sensitive HTML and XML characters.
JSF Example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:head />
<body>
<h:outputText value="#{messages.welcomeMessage}" style="font-weight:bold" />
</body>
</html>
This example was formatted by JSFToolbox for Dreamweaver.
com/mycompany/messages.properties
welcomeMessage=Welcome to our site!
faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
<application>
<resource-bundle>
<base-name>com.mycompany.messages</base-name>
<var>messages</var>
</resource-bundle>
</application>
</faces-config>
Rendered Output
HTML Output
<span style="font-weight:bold">Welcome to our site!</span>
|