1 Reply Latest reply on Dec 31, 2010 1:36 PM by nbelaevski

    Generating Dynamic MediaOutput using Java gives an error

    kapil29

      Hello

       

      I am trying to generate the Media Ouput componets to display the uploaded Image into the panel dynamically using JAVA code, but when I am trying to upload the image and reRender the thumbnail panel it gives me error "paint()" not found i.e. "javax.el.MethodNotFoundException: Method not found: com.dimestore.vi.web.controller.ProjectController@1cc2562.paint()". But the same is declared in my action controller class i.e "ProjectController.java" Class

       

      Here are my code

       

                          HtmlPanel thumbnailPanel = new HtmlPanel();
                          thumbnailPanel.setId("thumbnail_panel");

       

                          MediaOutput mediaOutput = new MediaOutput();
                          mediaOutput.setElement("img");
                          mediaOutput.setCacheable(false);
                          mediaOutput.setSession(true);
                          mediaOutput.setRendered(true);
                          mediaOutput.setValueExpression("mimeType", application.getExpressionFactory().createValueExpression(context.getELContext(),                     "#{projectBean.creativeWraper["+ i +"].mimeType}" , String.class));
                         

                          mediaOutput.setValueExpression("value", application.getExpressionFactory().createValueExpression(context.getELContext(),                     "#{projectBean.creativeWraper["+ i +"].fileName}" , String.class));

       

                          MethodExpression createContentExpressionObj = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().

                                  createMethodExpression(context.getELContext(), "#{projectController.paint}", null, new Class<?>[0]);
                          mediaOutput.setCreateContentExpression(createContentExpressionObj);

       

                          thumbnailPanel.getChildren().add(mediaOutput);

       

       

      ProjectController.java

       

      public void paint(OutputStream stream, Object object) throws IOException {

      // code for painting the image

      }

       

      Is there anything missed to add in my code?

       

      Kinldy help.....