xhtml的代码如下:
<h:form enctype="multipart/form-data" id="importForm">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<t:inputFileUpload id="upFile"
title="#{messages['global.label.import.browse']}"
value="#{attachmentAction.upFile}" storage="file"
maxlength="1000000">
</t:inputFileUpload>
</td>
</tr>
<tr>
<td>
<h:commandButton action="#{attachmentAction.upload}" value="#{messages['button.upload']}"
styleClass="btnCla" onclick="return checkSelectFile();" type="submit">
</h:commandButton>
</td>
</tr>
</table>
</h:form>
Action方法的代码如下。我只是想从客户那里得到一个excel。
public void upload(){
try {
jxl.Workbook wb = Workbook.getWorkbook(upFile.getInputStream());// Here , I always got Null for the value of upFile! Why?
wb.getSheet(0);
} catch (Exception e) {
}
}
对于 upFile 的值,我总是得到 Null!为什么?