0 Replies Latest reply on Apr 9, 2011 3:43 AM by omid pourhadi

    creating s:fileUpload Dynamically

    omid pourhadi Apprentice


      I'm creating s:fileUpload dynamically but i've got this exception

      Caused by javax.servlet.ServletException with message "#{addComponent.addcmp}:
       java.lang.ClassCastException org.jboss.seam.ui.component.html.HtmlFileUpload cannot be cast to 


      import javax.faces.application.Application;
      import javax.faces.context.FacesContext;
      import javax.faces.component.UIComponent;
      import javax.faces.component.html.HtmlInputText;
      import org.jboss.seam.ui.component.html.HtmlFileUpload;
      public class AddComponent {
           protected UIComponent component;
           public UIComponent getComponent() {
                return component;
           public void setComponent(UIComponent component) {
                this.component = component;
           public AddComponent() {
           public String addcmp(){
                FacesContext fc = FacesContext.getCurrentInstance();
                Application app=  fc.getApplication();
      //          HtmlInputText comp = (HtmlInputText)  app.createComponent("javax.faces.HtmlInputText");
                HtmlFileUpload comp = (HtmlFileUpload)  app.createComponent("org.jboss.seam.ui.FileUpload");
                return null;

      i can add other jsf component successfully How can i solve this problem ?

      Thanks in advanced