You can drag the Static Text component from
the Basic category of the Palette to the Visual Designer to provide instructions, titles,
headings, and similar text information for your pages. If you want to add a label to a component, use either a Label component or the component's
label
property, not the Static Text component.
After dragging the component to the Visual Designer, you can do a number of things with it:
text
property.
Static Text
initially displayed for this component
is a placeholder that goes away when the component is rendered.
If you want a default label to appear in your application,
you must add one either by typing in the component, editing
the text
property, or binding the component to a database
or object that supplies the default value.id
attribute. In the page bean, this property's
value is the name of the StaticText
object.text
property.
text
property to an object or a data provider, as described in the topic Bind to Data Dialog Box. text
property to other objects or bean properties that update this component's properties automatically.<ui:staticText id="staticText1" text="At {1,time} on {1,date}, there were {2} on planet {0,number,integer}."> <f:param id="param0" value="#{SessionBean1.myInt}"/> <f:param id="param1" value="#{SessionBean1.myDate}"/> <f:param id="param2" value="2 Spxfyzt"/> </ui:staticText>
This code requires that you add a property of type int
named myInt
and a property of type java.util.Date
named myDate
to SessionBean1 in the Projects Window, and that you bind the value properties of param0 and param1 respectively to these SessionBean1 properties. The parameterized text in this code sample will render something like, "At 8:36:18 AM on Dec 13, 2005, there were 2 spxfyzt on planet 7."