如何将 Part 转换为 Blob,以便将其存储在 MySQL 中?这是一个图像。谢谢
我的表格
<h:form id="form" enctype="multipart/form-data">
<h:messages/>
<h:panelGrid columns="2">
<h:outputText value="File:"/>
<h:inputFile id="file" value="#{uploadPage.uploadedFile}"/>
</h:panelGrid>
<br/><br/>
<h:commandButton value="Upload File" action="#{uploadPage.uploadFile}"/>
</h:form>
我的豆子
@Named
@ViewScoped
public class UploadPage {
private Part uploadedFile;
public void uploadFile(){
}
}