[OmniFaces utilities] The
getCurrentCommand() method returns the currently invoked UI command component, or null if there is none, which may happen when the current request is not a postback request at all, or when the view has been changed by for example a successful navigation. If the latter is the case, you'd better invoke this method before navigation.Method:
| OmniFaces 2.4 | OmniFaces 2.0 | 
| 
 
see also: getCurrentActionSource() 
 | 
JSF Page
<h:form
id="myFormId">
 <o:outputLabel id="nameLabelId"
for="nameId" value="Name"/>
 <h:inputText id="nameId"
value="#{playerBean.name}"/>         
 <!-- The UICommand expected to be returned
by the Components.getCurrentCommand() -->
 <h:commandButton id="btnId"
value="Save" action="#{playerBean.someAction()}"/>  
</h:form>    
After the
above form is submitted
import
org.omnifaces.util.Components;
...
UICommand
command = Components.getCurrentCommand();
System.out.println("Command
clientId: " + command.getClientId());
Output:
Command
clientId: myFormId:btnId






Arrays
Converters

JSF 2 Tutorials at www.mkyong.com     
JavaServer Faces (JSF) Tutorial      


















Niciun comentariu :
Trimiteți un comentariu