writer.write(",url:'" + getResourceURL(facesContext, item.getUrl() + "'"));
if(item.getTarget() != null) writer.write(",target:'"+ item.getTarget() + "'");
if(onclick != null) writer.write(",onclick:{fn:function() {" + onclick + "}}");
} else {
if(form == null) {
throw new FacesException("ContextMenu : '" + menu.getClientId(facesContext) + "' must be inside a form element");
}
String formClientId = form.getClientId(facesContext);
String command = item.isAjax() ? buildAjaxRequest(facesContext, item, formClientId, menuItemClientId) : buildNonAjaxRequest(facesContext, item, formClientId, menuItemClientId);
command = onclick == null ? command : onclick + ";" + command;