[jboss-user] [JBoss Seam] - s:graphicImage problems with Sun JSF Impl

mustaghattack do-not-reply at jboss.com
Thu Jun 14 09:19:04 EDT 2007


I have few problems with seam's graphicImage component.
* NullPointerException due to getRenderType() != null
This is the encodeChildren method of UIComponentBase (Sun impl)

  |     /**
  |      * @throws NullPointerException {@inheritDoc}     
  |      */ 
  |     public void encodeChildren(FacesContext context) throws IOException {
  | 
  |         if (context == null) {
  |             throw new NullPointerException();
  |         }
  |         if (!isRendered()) {
  |             return;
  |         }
  |         String rendererType = getRendererType();
  |         if (rendererType != null) {
  |             getRenderer(context).encodeChildren(context, this);
  |         }
  | 
  |     }
  | 
Here is the UIGraphicImage component :

  |    @Override
  |    protected Renderer getRenderer(FacesContext context)
  |    {
  |       return null;
  |    }
  | 
But inherit a render type != null :

  |     public HtmlGraphicImage() {
  |         super();
  |         setRendererType("javax.faces.Image");
  |     }
  | 
My solution is easy : add a 0-arg constructor which disable the render type :

  |    public UIGraphicImage() {
  | 	   super();
  |        setRendererType( null );
  |    }
  | 
This is working now (I have the < img > tag in my page).

* Next problem : for some reason the DynamicImageResource doesnt get the same instance of DynamicImageStore, so the image is not found !
It's weird since the DynamicImageStore is a Session scope component.
=> I gave up at this point :)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4054355#4054355

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4054355



More information about the jboss-user mailing list