[jboss-user] [JBoss Seam] - s:graphicImage problem

seammm do-not-reply at jboss.com
Thu Feb 7 21:32:50 EST 2008


Hi - I am having difficult time for seemingly trivial task that is uploading a picture into a byte[] and displaying it. Uploading does not give any error but s:graphicImage does not show anything although productHome.instance.picture ne null IS satisfied. Any idea is appreciated. Thanks.


THIS IS THE UPLOAD FORM (productHome IS managed at this point and uploads just fine, I checked the blob field in mysql, it is not null) -----------------

    <h:form id="uploadForm" enctype="multipart/form-data">

        <rich:panel>
            <f:facet name="header">Upload picture for #{productHome.instance.name}</f:facet>
    
            <s:decorate id="fileDecoration" template="layout/edit.xhtml">
                <ui:define name="label">
                	<s:graphicImage rendered="#{productHome.instance.picture ne null}"
            			value="#{productHome.instance.picture}"/>
                </ui:define>
				<s:fileUpload id="file" 
					data="#{productHome.instance.picture}" 
              		contentType="#{productHome.instance.pictureContentType}"/> 
          	</s:decorate>
            
            
            
        </rich:panel>

        
            <h:commandButton id="save" 
                          value="Upload" 
                         action="#{productHome.upload}" />
            <h:commandButton id="done" 
                          value="Done" 
                         view="/product.xhtml" />
        
        
    </h:form>


THIS ARE THE FIELDS IN PRODUCT (getter for picture is marked @Lob) ----------------------

	private byte[] picture;
	private String pictureContentType;



THIS IS THE UPLOAD METHOD (IT GOES BACK TO UPLOAD FORM) --------------

	public String upload()
	{
		log.info("----UPLOAD CALLED " + getInstance().getPicture().length);
     
        return null; //"/product.xhtml";
	}



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

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



More information about the jboss-user mailing list