[jboss-user] [JBoss Seam] - Re: Displaying Picture from blob

stephenwilliams do-not-reply at jboss.com
Wed Jan 17 09:13:57 EST 2007


Hi 

Thanks for the answer petemuir!

I would like to get he Ajax4jsf solution working as everywhere I read it should just work with seam 1.1 GA but I am have a problem...

I get the error...

javax.el.ELException: /home.xhtml: Bean: demo.PaintBean$$EnhancerByCGLIB$$6f0837bd, property: paint
  | 	at com.sun.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:53)
  | 	at com.sun.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:39)
  | 	at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:232)
  | 	at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
  | 




I added the following in my facelet...
<a4j:mediaOutput createContent="#{hello.renderImage}" value="#{hello.value}.jpg" element="img" mimeType="image/jpeg" />
  | 


the following to my bean...


    public void renderImage(OutputStream out, Object data) throws IOException {
  | 		BufferedImage img = new BufferedImage(100,
  | 				50, BufferedImage.TYPE_INT_RGB);
  | 		Graphics2D graphics2D = img.createGraphics();
  | 		graphics2D.setBackground(Color.BLACK);
  | 		graphics2D.setColor(Color.WHITE);
  | 		graphics2D.clearRect(0, 0, 100, 50);
  | 		graphics2D.drawLine(5, 5, 100 - 5, 50 - 5);
  | 		graphics2D.drawChars(new String("Ajax4JSF").toCharArray(), 0, 8,
  | 				40, 15);
  | 		graphics2D.drawChars(new String("mediaOutput").toCharArray(), 0,
  | 				11, 5, 45);
  | 		ImageIO.write(img, "jpeg", out);
  |     }	
  | 
  | 


the following to my interface...
	public void renderImage(OutputStream out, Object data) throws IOException;
  | 
  | 

and then deployed it.


If anyone has allready done this I would really appreciate a small example. 


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

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



More information about the jboss-user mailing list