Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

JSF command links always perform a form submission via JavaScript, which breaks the web browser's "open in new window" or "open in new tab" feature. In plain JSF, you need to use an <h:outputLink> if you need this functionality. But there are two major limitations to <h:outputLink>.
  • JSF provides no way to attach an action listener to an <h:outputLink>.
  • JSF does not propagate the selected row of a DataModel since there is no actual form submission.
Seam provides the notion of a page action to help solve the first problem, but this does nothing to help us with the second problem. We could work around this by using the RESTful approach of passing a request parameter and requerying for the selected object on the server side. In some cases—such as the Seam blog example application—this is indeed the best approach. The RESTful style supports bookmarking, since it does not require server-side state. In other cases, where we don't care about bookmarks, the use of @DataModel and @DataModelSelection is just so convenient and transparent!
To fill in this missing functionality, and to make conversation propagation even simpler to manage, Seam provides the <s:link> JSF tag.
The link may specify just the JSF view id:
<s:link view=“/login.xhtml” value=“Login”/>
Or, it may specify an action method (in which case the action outcome determines the page that results):
<s:link action=“#{login.logout}” value=“Logout”/>
If you specify both a JSF view id and an action method, the 'view' will be used unless the action method returns a non-null outcome:
<s:link view="/loggedOut.xhtml"  action=“#{login.logout}” value=“Logout”/>
The link automatically propagates the selected row of a DataModel using inside <h:dataTable>:
<s:link view=“/hotel.xhtml” action=“#{hotelSearch.selectHotel}” value=“#{hotel.name}”/>
You can leave the scope of an existing conversation:
<s:link view=“/main.xhtml” propagation=“none”/>
You can begin, end, or nest conversations:
<s:link action=“#{issueEditor.viewComment}” propagation=“nest”/>
If the link begins a conversation, you can even specify a pageflow to be used:
<s:link action=“#{documentEditor.getDocument}” propagation=“begin” 
        pageflow=“EditDocument”/>
The taskInstance attribute if for use in jBPM task lists:
<s:link action=“#{documentApproval.approveOrReject}” taskInstance=“#{task}”/>
(See the DVD Store demo application for examples of this.)
Finally, if you need the "link" to be rendered as a button, use <s:button>:
<s:button action=“#{login.logout}” value=“Logout”/>

 
 
  Published under the terms of the Open Publication License Design by Interspire