code: @Override
  	public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
  		if (!component.isRendered()) {
  			return;
  		}
  		RemoteCommand remoteCommand = (RemoteCommand) component;
  		ResponseWriter rw = context.getResponseWriter();
  		String clientId = remoteCommand.getClientId();
  
  		String parameters=remoteCommand.getParameters();
  		String parametersAsJson=null;
  		if (null != parameters && parameters.length()>0) {
  			parametersAsJson = "";
  			String[] params = parameters.split(",");
  			for (String p: params) {
  				p=p.trim();
  				parametersAsJson += "'" + p + "':" + p + ",";
  			}
  			parametersAsJson=parametersAsJson.substring(0, parametersAsJson.length()-1);
  		}
  		StringBuilder call = AJAXRenderer.generateAJAXCall(context, remoteCommand, null, parametersAsJson);
  		String name = remoteCommand.getName();
  		if (null == name) {
  			throw new FacesException("b:remoteCommand: Please define the name of the JavaScript function calling the Java backend.");
  		}
  			
  		rw.startElement("script", component);
  		rw.writeAttribute("id", clientId, null);
  		String c = call.toString().replace("callAjax(this,", "callAjax(document.getElementById('" + clientId + "'),");
  		if (parameters!=null) {
  			rw.append("function " + name + "(" + parameters + ", event){" + c + "}");
  		} else {
  			rw.append("function " + name + "(event){" + c + "}");
  		}
  		rw.endElement("script");
  
  	}
docs: This methods generates the HTML code of the current b:remoteCommand.
  @param context the FacesContext.
  @param component the current b:remoteCommand.
  @throws IOException thrown if something goes wrong when writing the HTML code.