Web Based Ajax Terminal

PrimeFaces brings desktop terminals to the web, p:terminal is an ajax powered JSF component to execute commands defined on server side. Usage is very simple, just place the terminal and provide a command handler.

Screen shot 2009-10-20 at 8.47.11 PMCode

    <p:terminal commandHandler="#{mybean.handleCommand}" />

CommandHandler is a simple java method taking two parameters, first one is the name of the command and second parameter is an array of command arguments.

    public String handleCommand(String command, String[] params) {
			return "Hello" + params[0];
		else if(command.equals("date"))
			return new Date().toString();
			return command + " " + not found;

Terminal in Mock OS X
I’ve integrated terminal to famous PrimeFaces Mock OS X, there’s a terminal icon in the dock displaying the terminal in a dialog. Check out the terminal in Mock OS X demo. CommandHandler is the one I’ve posted above with greet and date commands.

More Demos
There’re two more terminal demos;
* Terminal in a dialog
* Full page Terminal

Aim of PrimeFaces is to create the Ultimate Component Suite to rule them all. What PrimeFaces has so far is just the beginning.


4 Responses to Web Based Ajax Terminal

  1. İs there any wrong with handleCommand method, Cağatay?
    Two same condition check?

    return “Hello” + params[0];
    else if(command.equals(“date”))

  2. Oh, WoW, That is neat. I am going to have to try it.

  3. Pingback: primefaces – JSF und YUI « Orgeltom's Blog

%d bloggers like this: