4 Replies Latest reply on Jun 30, 2009 2:53 AM by orkun

    MediaOutput    MediaOutput object in "javabean"

    orkun



      hello

      I tried to create MediaOutput in java bean

      After creating MediaOutput object ,
      MediaOutput myMedia = new MediaOutput ();

      I have byte data, but I couldn't use it for MediaOutput
      object in "javabean".

      I guess, I have to manage this:( But I can't )

      myMedia.setcreateContent (????,???)

      how can I do that ?

      thanks in advance

        • 1. Re:  MediaOutput    MediaOutput object in
          nbelaevski

          1. Create MethodExpression (check TLD file for signature)
          2. Call setCreateContent() and pass created MethodExpression as argument

          • 2. Re:  MediaOutput    MediaOutput object in
            orkun

            thank you

            I was wondering where I could find an example code ?

            regards

            • 3. Re:  MediaOutput    MediaOutput object in
              nbelaevski

              In the sources of tag/tag handler class for this component.

              • 4. Re:  MediaOutput    MediaOutput object in
                orkun

                hello

                I tried in this way:

                MediaOutput myMedia = new MediaOutput ();

                String style = "width:600px ; height:450px ; border='1px'";
                myMedia.setStyle(style);
                myMedia.setCacheable(false);

                ExpressionFactory expressionFactory = FacesContext.getCurrentInstance().getApplication().getExpressionFactory();

                ELContext elContext = FacesContext.getCurrentInstance().getELContext();

                MethodExpression mediaMethodExpression = expressionFactory.createMethodExpression(elContext,
                "#{haritaBean1.drawFoto}",
                null,
                new Class[] {OutputStream.class,Object.class} );

                myMedia.setCreateContentExpression(mediaMethodExpression);
                myMedia.setCacheable(false);

                //view.getChildren().add(myMedia);
                children.add(myMedia);

                but no image can be seen

                What did I do wrong ?

                regards