UIComponent component,
String clientId)
throws IOException
{
//Find form
FormInfo formInfo = findNestingForm(component, facesContext);
if (formInfo == null)
{
String path = RendererUtils.getPathToComponent(component);
String msg = "Link is not embedded in a form. Change component/tag '" + clientId + "' from javax.faces.*/<h:tagName /> " +
"to org.apache.myfaces.*/<t:tagName />, or embed it in a form. This is not a bug. " +
"Please see: http://wiki.apache.org/myfaces/Upgrading_to_Tomahawk_1.1.3 " +
"The path to this component is " + path + ". If you need to render a special form and a JSF-form's attributes are not enough," +
"consider using the s:form tag of the MyFaces sandbox.";
throw new IllegalArgumentException(msg);
}
UIComponent nestingForm = formInfo.getForm();
String formName = formInfo.getFormName();
StringBuffer onClick = new StringBuffer();
String commandOnclick;
if (component instanceof HtmlCommandLink)
{
commandOnclick = ((HtmlCommandLink)component).getOnclick();
}
else
{
commandOnclick = (String)component.getAttributes().get(HTML.ONCLICK_ATTR);
}
if (commandOnclick != null)
{
onClick.append("var cf = function(){");
onClick.append(commandOnclick);
onClick.append('}');
onClick.append(';');
onClick.append("var oamSF = function(){");
}
if (RendererUtils.isAdfOrTrinidadForm(formInfo.getForm())) {
onClick.append("submitForm('");
onClick.append(formInfo.getForm().getClientId(facesContext));
onClick.append("',1,{source:'");
onClick.append(component.getClientId(facesContext));
onClick.append("'});return false;");
}
else {