Problems with rendering HTML page
ozorin Oct 11, 2011 10:27 AMHi,
I use Richfaces 4.0.0 Final, Mojarra 2.1.2, and following problem:
When the programmatically generate a JSF Form (HtmlForm) that contains the UITabPanel, when reload HTML pages do not include all Richfaces javascript libraries in <head> (as a result of tabs are not rendered). The JSF Form itself was created when the first call (page is rendered normally) and stored in the session bean.
Bean:
public class DynamicApplicationBuilder implements Serializable {
    private static final long serialVersionUID = 1L;
    private String formId;
    private DynamicForm dynamicFormObject;
    private HtmlForm dynamicFormView;
    ...
    private void generatedApplicationForm() {
        ...
        FacesContext facesContext = FacesContext.getCurrentInstance();
        Application application = facesContext.getApplication();
        dynamicFormView = (HtmlForm) application.createComponent(facesContext,
                HtmlForm.COMPONENT_TYPE, "javax.faces.Form");
        UITabPanel tabPanel = (UITabPanel) application.createComponent(
                facesContext, UITabPanel.COMPONENT_TYPE,
                "org.richfaces.TabPanelRenderer");
        tabPanel.setSwitchType(SwitchType.ajax);
        for (int indexTab = 0; indexTab < dynamicFormObject.getFormContent().size(); indexTab++) {
             UITab tab = (UITab) application.createComponent(facesContext,
                    UITab.COMPONENT_TYPE, "org.richfaces.TabRenderer");
               
               ...
             tabPanel.getChildren().add(tab);
        }
        dynamicFormView.getChildren().add(tabPanel);
        HtmlCommandButton comBut = (HtmlCommandButton) application
                .createComponent(facesContext,
                        HtmlCommandButton.COMPONENT_TYPE, "javax.faces.Button");
        comBut.setValue("-Send-");
        comBut.setActionExpression(JSFUtil.createAction("#{dynamicApplicationBuilder.testField}", String.class));
        dynamicFormView.getChildren().add(comBut);
    }
...
    public HtmlForm getDynamicFormView() {
        if (dynamicFormView == null) {
           generatedApplicationForm();
        }
        return dynamicFormView;
    }
    public void setDynamicFormView(HtmlForm dynamicFormView) {
        this.dynamicFormView = dynamicFormView;
    }
}
XHTML page:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    template="/layout/lo_template.xhtml">
    ...
    <ui:define name="mainContent">
        <h:form id="formDAB" binding="#{dynamicApplicationBuilder.dynamicFormView}"  />
    </ui:define>
</ui:composition>
Any ideas?
 
    