Saturday, September 28, 2013

Creating hyperlink with JSF components

normally JSF components accept an outcome from navigation case to generate hyperlink.
<h:link value="my link" outcome="MY_OUTCOME" />

<h:commandButton value="my button" action="MY_OUTCOME" />

<h:outputLink value="MY_OUTCOME">my link</h:outputLink />

But hyperlink generated with JSF outcome is only within the same application.
That's mean hyperlink generated with JSF components are unable to navigate to other sites. eg,

This problem could be resolved by <h:outputLink /> where the value attribute also accepts an URL.
<h:outputLink value="">
    <h:outputText value="Google" />
    <f:param name="param1" value="value1" />
    <f:param name="param2" value="value2" />

With the above codes, the <h:outputLink /> component able to generate hyperlink to

<f:param /> is optional, required only when passing parameters


No comments:

Post a Comment


Related Posts Plugin for WordPress, Blogger...