简体   繁体   中英

NullPointerException when uploading a file .xlsx

Such a problem, I follow the instructions from

http://www.awasthiashish.com/2017/01/import-data-from-xls-and-xlsx-excel-to.html

On the line throws NullPointerException

CollectionModel cModel = (CollectionModel) empTable.getValue();

I don't understand what to do, please help me!

jsff file:

<af:inputFile label="Select File" id="if1"                                   
valueChangeListener="#{pageFlowScope.Class1Bean.uploadFileVCE}"
autoSubmit="true" 
labelStyle="font-weight:bold;color:navy;"/>

You forgot to create the component binding for the table to the bean where you read the data. In the page holding the table, select the table and add the component binding in the binding property.

Sample enter link description here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM