Como exibir imagem gravada no banco, usando JSF?
Eu gravei uma foto (byte) no MySql e agora preciso exibi-la. Mas está dando o seguinte erro:
SEVERE: Unable to get parts for j_idt7:j_idt12
javax.servlet.ServletException: org.apache.tomcat.util.http.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded;charset=UTF-8
grupoUsuarioCadastro.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
...
<h:form enctype="multipart/form-data" >
...
<h:dataTable
id="tabela"
value ="#{grupoUsuarioControlador.grupoUsuarios}"
var ="grupo"
...
<h:column>
<f:facet name ="header">
<h:outputText value ="Foto"/>
</f:facet>
<h:graphicImage value="#{grupo.fotoFrente}" id="imagem"/>
</h:column>
SEVERE: Unable to get parts for j_idt7:j_idt12
javax.servlet.ServletException: org.apache.tomcat.util.http.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded;charset=UTF-8
grupoUsuarioCadastro.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
...
<h:form enctype="multipart/form-data" >
...
<h:dataTable
id="tabela"
value ="#{grupoUsuarioControlador.grupoUsuarios}"
var ="grupo"
...
<h:column>
<f:facet name ="header">
<h:outputText value ="Foto"/>
</f:facet>
<h:graphicImage value="#{grupo.fotoFrente}" id="imagem"/>
</h:column>
Nilton Bertoldo
Curtidas 0
Respostas
Robson Teixeira
01/11/2012
sugiro você usar uma tag html para exibir a imagem e para realizar a renderização da mesma sugiro usar um servlet para isso.
att
robson
att
robson
GOSTEI 0