Terminal commands are handled by a server side listener. "greet {text}" and "date" are sample commands.
Documentation<h:form>
<p:focus for="terminal" />
<p:terminal id="terminal" widgetVar="term" commandHandler="#{terminalBasicView.handleCommand}"
welcomeMessage="Welcome to PrimeFaces Terminal, how are you today?" />
<p:commandButton type="button" value="Clear" icon="pi pi-trash" onclick="PF('term').clear()" style="margin-top:10px"/>
</h:form>@Named("terminalBasicView")
@ViewScoped
public class BasicView implements Serializable {
public String handleCommand(String command, String[] params) {
if(command.equals("greet")) {
if(params.length > 0)
return "Hello " + params[0];
else
return "Hello Stranger";
}
else if(command.equals("date"))
return new Date().toString();
else
return command + " not found";
}
}