| |||||||
FRAMES NO FRAMES |
Use the webuijsf:hyperlink
tag to display a HTML
hyperlink to a URL, or a link that submits a form.
If you intend to use the hyperlink for navigating to a different
page by using the url attribute, consider using the webuijsf:anchor
component instead of the hyperlink component.
If UIParameter components are specified as children to the hyperlink component and an url attribute exists, then the behavior of the url here is similar to the one observed with the anchor component. The name, value pairs of the UIParameter components are added as request parameters to the url attribute. If no url is specified for the hyperlink, then this will be passed on to the hyperlink widget as a JSON array where these name/value pairs will be appended as request parameters when the hyperlink is clicked and the form is submitted.
If the disabled attribute of the hyperlink is set to true, clicking the hyperlink on the browser will not generate a request and hence the form will not be submitted or the page will not navigate to the specified url depending on whether the url has been specified or not.
The rendered HTML page displays an XHTML <a> element. If the link submits the form the onclick will have some additional behavior that the user should be aware of. See the onClick attribute below.
document.getElementById(id).setProps({disabled:
true})
.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.hyperlink.event.<eventname>.endTopic,
processEvents, "update");
</webuijsf:script>
webui.suntheme.widget.hyperlink.event.refresh.beginTopic | Event topic published before asynchronously refreshing the
component. Supported properties include:
|
webui.suntheme.widget.hyperlink.event.refresh.endTopic | Event topic published after asynchronously refreshing the
component. Supported properties include: See setProps() function.
|
<webuijsf:hyperlink id="hyperlinktest1"
text="#{HyperlinkBean.text}"
actionExpression="#{HyperlinkBean.success}" />
Note: id can be used as a unique identifier if the hyperlink is programatically addressed.
This example sets the url attribute, which signifies that this link will not submit to the server and will be a straight hyperlink.
<webuijsf:hyperlink id="hyperlinktest2"
text="#{HyperlinkBean.text}" url="http://www.google.com" />
This example shows how to use other components as children of the hyperlink tag.
<webuijsf:hyperlink id="hyperlinktest3"
url="http://www.sun.com">
<webuijsf:image url="myyahoo.gif" />
<webuijsf:staticText text="more text"
/>
</webuijsf:hyperlink>
When this link is clicked, the page will be submitted and the request parameter map will have two additional items in it: testingParam1 and testingParam2, with their associated values.
<webuijsf:hyperlink id="hyperlinktest1"
text="#{HyperlinkBean.label}"
actionExpression="#{HyperlinkBean.success}" >
<f:param name="testingParam1"
value="success!"/>
<f:param name="testingParam2"
value="failure!"/>
</webuijsf:hyperlink>
<webuijsf:hyperlink id="form1:hyperlink1"
text="#{HyperlinkBean.text}" actionExpression="#{hyperlinkBean.action}"
/> Click here </webuijsf:hyperlink>
<webuijsf:button id="button1" text="Hide hyperlink"
onClick="toggleVisible()"/>
< script type="text/javascript">
function toggleVisible() {
var domNode =
document.getElementById("form1:hyperlink1");
var props =
domNode.getProps();
if (domNode != null) {
domNode.setProps({"visible":!props.visible});
}
}
</script>
text="#{MyBean.text}"
<webuijsf:hyperlink id="hyperlink1"
<webuijsf:button id="
/>
button1
" text="#{MyBean.text}" onClick="refreshHyperlink();return false;"/>
<webuijsf:script>
function refreshHyperlink() {
var domNode =
document.getElementById("form1:hyperlink1"); // Get hyperlink
return domNode.refresh();
//
Asynchronously refresh hyperlink
}
</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.text="#{MyBean.text}"/
<webuijsf:hyperlink id="hyperlink1"
>
<webuijsf:textField id="field1" text="#{MyBean.text}" label="Change hyperlink Text"
onKeyPress="setTimeout('refreshHyperlink();', 0);"/> // Field used to asynchronously update text.
<webuijsf:script>
function
refreshHyperlink
()
{
var domNode =
document.getElementById("form1:hyperlink1"); // Get hyperlink
return
domNode.refresh("form1:field1"); // Asynchronously refresh while
submitting field value
}
</webuijsf:script>
Tag Information | |
Tag Class | com.sun.webui.jsf.component.HyperlinkTag |
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. |
onKeyPress | false | false | java.lang.String | Scripting code executed when the user presses and releases a key while the component has focus. |
target | false | false | java.lang.String | The resource at the specified URL is displayed in the frame that is specified with the target attribute. Values such as "_blank" that are valid for the target attribute of a HTML anchor element are also valid for this attribute in this component |
onFocus | false | false | java.lang.String | Scripting code executed when this component receives focus. An element receives focus when the user selects the element by pressing the tab key or clicking the mouse. |
urlLang | false | false | java.lang.String | The language code of the resource designated by this hyperlink. |
onKeyUp | false | false | java.lang.String | Scripting code executed when the user releases a key while the component has focus. |
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. |
style | false | false | java.lang.String | CSS style(s) to be applied to the outermost HTML element when this component is rendered. |
url | false | false | java.lang.String | Absolute, relative, or context relative (starting with "/") URL to the resource selected by this hyperlink. If the url attribute is specified, clicking this hyperlink sends the browser to the new location. If the action attribute is specified, the form is submitted. If both are specified, the url attribute takes precedence. |
onClick | false | false | java.lang.String | Scripting code executed when a mouse click occurs over this component. If the component submits the form (by using the action attribute), the script that you use with the onClick attribute should not return from the function. When the action attribute is used, the component handles the return with a script that is appended to the anchor element's onclick property. When you supply an onClick attribute, this return script is appended after your script in the anchor's onclick. It is ok to return from your script to abort the submit process if necessary. |
onBlur | false | false | java.lang.String | Scripting code executed when this element loses focus. |
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. |
type | false | false | java.lang.String | The MIME content type of the resource specified by this component. |
disabled | false | false | java.lang.String | Flag indicating that clicking of this component by the user is not currently permitted. |
onMouseOut | false | false | java.lang.String | Scripting code executed when a mouse out movement occurs over this component. |
onMouseOver | false | false | java.lang.String | Scripting code executed when the user moves the mouse pointer into the boundary of this component. |
onMouseMove | false | false | java.lang.String | Scripting code executed when the user moves the mouse pointer while over the component. |
htmlTemplate | false | false | java.lang.String | Alternative HTML template to be used by this component. |
text | false | false | java.lang.String | The text to be displayed for the hyperlink. |
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. |
onKeyDown | false | false | java.lang.String | Scripting code executed when the user presses down on a key while the component has focus. |
tabIndex | false | false | java.lang.String | Position of this element in the tabbing order of the current document. Tabbing order determines the sequence in which elements receive focus when the tab key is pressed. The value must be an integer between 0 and 32767. |
immediate | false | false | java.lang.String | Flag indicating that event handling for this component should be handled immediately (in Apply Request Values phase) rather than waiting until Invoke Application phase. |
actionExpression | false | false | java.lang.String | MethodExpression representing the application action to invoke when this component is activated by the user. The expression must evaluate to a either a String or a public method that takes no parameters, and returns a String (the logical outcome) which is passed to the NavigationHandler for this application. |
actionListenerExpression | false | false | java.lang.String | Use the actionListenerExpression attribute to cause the component to fire an event. The value must be an EL expression and it must evaluate to the name of a public method that takes an ActionEvent parameter and returns void. |
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. |
id | false | true | java.lang.String | No Description |
Variables | No Variables Defined. |
| |||||||
FRAMES NO FRAMES |