Guest User

Untitled

a guest
Jan 16th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. Uncaught TypeError: Cannot read property 'getAttribute' of undefined
  2. at Object.response (jsf.js.xhtml?ln=javax.faces&stage=Development:2814)
  3. at Object.onComplete (jsf.js.xhtml?ln=javax.faces&stage=Development:1779)
  4. at FrameTransport.AjaxEngine.req.xmlReq.onreadystatechange (jsf.js.xhtml?ln=javax.faces&stage=Development:1760)
  5. at FrameTransport.callback (jsf.js.xhtml?ln=javax.faces&stage=Development:367)
  6. at HTMLIFrameElement.<anonymous> (jsf.js.xhtml?ln=javax.faces&stage=Development:400)
  7.  
  8. <h:inputFile value="#{imagemPerfil.arquivo}" required="true" >
  9.  
  10. </h:inputFile>
  11. <h:commandButton
  12. class="btn btn-primary" value="Salvar" action="#{imagemPerfil.handleFileUpload()}">
  13.  
  14. <f:ajax execute="@form" render="@form" />
  15.  
  16. </h:commandButton>
  17.  
  18. </h:form>
  19.  
  20. /**
  21. *
  22. */
  23. private static final long serialVersionUID = 3131478679593318664L;
  24. private Part arquivo;
  25. private UploadedFile uploadFile;
  26.  
  27. public Part getArquivo() {
  28. return arquivo;
  29. }
  30.  
  31. public void setArquivo(Part arquivo) {
  32. this.arquivo = arquivo;
  33. }
  34.  
  35.  
  36. public UploadedFile getUploadFile() {
  37. return uploadFile;
  38. }
  39.  
  40. public void setUploadFile(UploadedFile uploadFile) {
  41. this.uploadFile = uploadFile;
  42. }
  43.  
  44. public MudarImagemPerfil() {
  45.  
  46. }
  47.  
  48. public void handleFileUpload() {
  49.  
  50. if(arquivo != null) {
  51. System.out.println("file size: " + arquivo.getSize());
  52. System.out.println("file type: " + arquivo.getContentType());
  53. }else {
  54. System.out.println("Arquivo está nulo");
  55. }
  56.  
  57. }
Add Comment
Please, Sign In to add comment