| |||||||
FRAMES NO FRAMES |
Use the webuijsf:staticText
tag to display text that is not
interactive in the rendered HTML page. The text can be plain
static text, or be formatted using parameters to insert variable text
in the rendered HTML. The JSF core tag f:param
can be used along with view beans to
provide the variable data.
If there are one or more params, the component will
convert the list of parameter values to an
Object
array,
and call MessageFormat.format()
, passing the value of the
param of this component as the first argument, the value of the array
of parameter values as the second argument, and render the result. See MessageFormat.format()
for
details.Otherwise, render the text of this component
unmodified.
<span>
element that contains the resulting
text. In the <span>
element, the class and style attribute
values are set to the values specified with the webuijsf:staticText
tag's styleclass and style attributes.
document.getElementById(id).setProps({value:
"My Text"})
.getProps() |
Use this function to get widget properties. Please see setProps()
function for a list of supported properties. |
refresh(execute) |
Use this function to
asynchronously refresh the component.
|
setProps(props) |
Use this function to change any of the following supported
properties:
|
When the component is manipulated client side, some functions may
publish event topics for custom AJAX implementations to listen for.
Using the Dojo event system, listen for the refresh event topic using:
<webuijsf:script>
var processEvents =
{
update: function(props) {
//
Do something...
}
}
// Subscribe to refresh event.
dojo.subscribe(webui.suntheme.widget.staticText.event.<eventname>.endTopic,
processEvents, "update");
</webuijsf:script>
The following events are supported.
webui.suntheme.widget.staticText.event.refresh.beginTopic | Event topic published before asynchronously refreshing the
component. Supported properties include:
|
webui.suntheme.widget.staticText.event.refresh.endTopic | Event topic published after asynchronously refreshing the
component. Supported properties include: See setProps() function.
|
<webuijsf:staticText
id="statictext1" text="#{bean.someText}" />
<webuijsf:staticText id="statictext1" text="some text
to display" />
<webuijsf:staticText id="blah"
text="At {1,time} on {1,date}, there was {2} on planet
{0,number,integer}.">
<f:param
id="b1" value="#{HyperlinkBean.myInt}"/>
<f:param
id="b2" value="#{HyperlinkBean.date}"/>
<f:param
id="b3" value="2
fools"/>
</webuijsf:staticText>
The above will render: "At 8:36:18
AM on Dec 13, 2004, there was 2 fools on planet 7."
<webuijsf:radioButton id="rb1" name="rb1" label="Toggle Text Visible" onClick="toggleVisible()"/><webuijsf:staticText id="text1" text="My Text" />
<webuijsf:script>
function toggleVisible() {
var domNode = document.getElementById("form1:text1"); // Get text
return domNode.setProps({visible: !domNode.getProps().visible}); // Toggle visible
}
</webuijsf:script>
<webuijsf:radioButton id="rb1" name="rb1" label="Refresh Button" onClick="refreshText()"/>
<webuijsf:staticText id="text1
" text="#{MyBean.text}"/>
<webuijsf:script>
function refreshText() {
var domNode =
document.getElementById("form1:text1"); // Get text
return domNode.refresh(); //
Asynchronously refresh text
}
</webuijsf:script>
Note that the refresh function can optionally take a list of
elements
to execute. Thus, a comma-separated list of ids can be provided to
update components server-side: refresh("form1:id1,form2:id2,..."). When
no parameter is given, the refresh function acts as a reset.
That is, the component will be redrawn using values set
server-side, but not updated.<webuijsf:staticText id="text1
" text="#{MyBean.text}"/>
<webuijsf:textField id="field1" text="#{MyBean.text}" label="Change Text"
onKeyPress="setTimeout('refreshText();', 0);"/> // Field used to asynchronously update text.
<webuijsf:script>
function
refreshText
() {
var domNode =
document.getElementById("form1:text1"); // Get text
return
domNode.refresh("form1:field1"); // Asynchronously refresh while
submitting field value
}
</webuijsf:script>
Tag Information | |
Tag Class | com.sun.webui.jsf.component.StaticTextTag |
TagExtraInfo Class | None |
Body Content | JSP |
Display Name | None |
Attributes | ||||
Name | Required | Request-time | Type | Description |
binding | false | false | java.lang.String | A ValueExpression that resolves to the UIComponent that corresponds to this tag. This attribute allows the Java bean that contains the UIComponent to manipulate the UIComponent, its properties, and its children. |
onMouseDown | false | false | java.lang.String | Scripting code executed when the user presses a mouse button while the mouse pointer is on the component. |
toolTip | false | false | java.lang.String | Sets the value of the title attribute for the HTML element. The specified text will display as a tooltip if the mouse cursor hovers over the HTML element. |
onDblClick | false | false | java.lang.String | Scripting code executed when a mouse double click occurs over this component. |
converter | false | false | java.lang.String | The converter attribute is used to specify a method to translate native
property values to String and back for this component. The converter
attribute value must be one of the following:
|
onMouseOut | false | false | java.lang.String | Scripting code executed when a mouse out movement occurs over this component. |
rendered | false | false | java.lang.String | Use the rendered attribute to indicate whether the HTML code for the component should be included in the rendered HTML page. If set to false, the rendered HTML page does not include the HTML for the component. If the component is not rendered, it is also not processed on any subsequent form submission. |
escape | false | false | java.lang.String | Escape the html text so it won't be interpreted by the browser as HTML |
id | false | true | java.lang.String | No Description |
onMouseOver | false | false | java.lang.String | Scripting code executed when the user moves the mouse pointer into the boundary of this component. |
htmlTemplate | false | false | java.lang.String | Alternative HTML template to be used by this component. |
onMouseMove | false | false | java.lang.String | Scripting code executed when the user moves the mouse pointer while over the component. |
onMouseUp | false | false | java.lang.String | Scripting code executed when the user releases a mouse button while the mouse pointer is on the component. |
styleClass | false | false | java.lang.String | CSS style class(es) to be applied to the outermost HTML element when this component is rendered. |
text | false | false | java.lang.String | The text to be displayed for this component. |
style | false | false | java.lang.String | CSS style(s) to be applied to the outermost HTML element when this component is rendered. |
visible | false | false | java.lang.String | Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page. If set to false, the HTML code for the component is present in the page, but the component is hidden with style attributes. By default, visible is set to true, so HTML for the component HTML is included and visible to the user. If the component is not visible, it can still be processed on subsequent form submissions because the HTML is present. |
onClick | false | false | java.lang.String | Scripting code executed when a mouse click occurs over this component. |
Variables | No Variables Defined. |
| |||||||
FRAMES NO FRAMES |