[color=darkred]Beleza galera,
Bem, meu problema é este, estou fazendo um cadastro de imagens, estou utilizando o rich faces “UPLOAD” para fazer o mesmo . Está carregando o upload inserindo normalmente mais a area onde mostra a imagem, não está carregando pois uso REQUEST já testei com SESSION e funciona normal .Quando clico em upload ele faz a rederização da componete do a4jmediaOutput , ele carregas as informações como o {nome, tamanho,…} mas não carrega a imagem ela ficao com o x vermelho no canto esquerdo como se tivesse ali mais o faltando algo!
teria como alguem me ajudar ??w
segue meu código:
public class Imagem implements Serializable{
private String nome;
private int tamanho;
private byte[] dados;
//…
}
No Managed Bean:
listener do richFileUpload:
public void listener(UploadEvent event) {
UploadItem item = event.getUploadItem();
File file = new File();
file.setTipo(item.getContentType());
file.setLength(item.getData().length);
file.setNome(item.getFileName());
file.setImagem(item.getData());
cliente.setFoto(file);
}
paint para carregar imagem no a4j:mediaOutput
public void paint(OutputStream stream, Object object) throws IOException {
byte[] bt = cliente.getFoto().getImagem();
stream.write(bt);
}
tag do mediaOutput :
<h:panelGrid columns=“2”>
<a4j:mediaOutput element=“img”
createContent="#{clienteManagedBean.paint}"
style=“width:100px; height:100px;” cacheable=“false”
session=“true”>
<c:param value="#{clienteManagedBean.timeStamp}" name=“time” />
</a4j:mediaOutput>
<h:panelGrid columns=“2”>
<h:outputText value=“File Name:” />
<h:outputText value="#{file.nome}" />
<h:outputText value=“File Length(bytes):” />
<h:outputText value="#{file.length}" />
</h:panelGrid>
</h:panelGrid>
alguem pode ajudar ??
vlws