java - How to get the file name when using Part to upload files with JSF? -


i'm using below code snippet upload file using jsf

 private part uploadedfile;  public part getuploadedfile() {     return uploadedfile; } public void setuploadedfile(part uploadedfile) {     this.uploadedfile = uploadedfile; } public void processfileupload() {   if(!(uploadedfile==null)) { filename = uploadedfile.getname(); system.out.println(filename); filesize = uploadedfile.getsize(); filecontenttype = uploadedfile.getcontenttype();  } else { system.out.println("null"); 

my jsp code snippets shown below

<h:form enctype = "multipart/form-data">  <h:outputlabel value="select file:" style="color:white"/> <h:inputfile id="fileupload" label="file upload" style="color:white" value="#{actionbeanworld.uploadedfile}" size="60" />   <h:commandbutton type = "submit" value = "upload"  action = "#{actionbeanworld.processfileupload}">  </h:commandbutton> 

the filename generated using uploadedfile.getname() generates part name j_id_jsp_903082837_1:fileupload wondering if there way filename uploaded? tried using uploadedfile.getsubmittedfilename(); , threw java.lang.abstractmethod error. please help!

abstractmethoderror thrown javax.servlet.http.part.getsubmittedfilename()

myfaces core affects version/s: 2.2.6, 2.2.8

please provide full details of jsf version , implementation , server on testing code.


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -