PEssoal,
Estou tentando utilizar o componente fileUpload do richaFaces: Já fiz igual a uns 200 tutoriais na internet porem não obtive sucesso.
Meu xhtml:
<h:outputText styleClass="dr-pnl-b rich-panel-body label"
style="padding-left: 0px;" value="Selecione:" />
<rich:fileUpload fileUploadListener="#{solicitacao.uploadArquivo}"></rich:fileUpload>
Meu java (Tentativa 1 - mais utilizada nos exemplos):
public void uploadArquivo(UploadEvent evento) throws FileNotFoundException {
try {
UploadItem item = evento.getUploadItem();
//long tamanho = item.getData().length;
String nome = item.getFileName();
byte[] arquivo = item.getData();
} catch (Exception e) {
e.printStackTrace();
}
}
tentativa 2:
public void uploadArquivo(UploadEvent evento) throws FileNotFoundException {
List<String> linhas = null;
UploadItem item = evento.getUploadItem();
File file = item.getFile();
// FileReader fr = new FileReader(file);
try {
InputStream is;
is = new FileInputStream(file);
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String linha = null;
linhas = new ArrayList<String>();
while ((linha = br.readLine()) != null) {
linhas.add(linha);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
o que acontece eh o seguinte …
no java 1 lá não da erro nenhum … nenhuma exception… porem o arquivo nao vem byte[] arquivo = item.getData();
o get data do Item que foi recebido do evento … esta vazio::
Aguem ja passou por isso , ou possa me dar uma luz no que está faltando!???
Desde ja agradeço a atençao de todos, Obrigado
OBs. estou usando JSF 1.2 com RichFaces 3.3.1, Servidor Weblogic 11g