我是 Vaadin 的新手,我想实现这个:一个包含用于单选的文件名的下拉列表。和一个上传文件按钮,上传文件后,文件名被添加到下拉列表中:
List <String> fileDirList = Utilities.getDirectoryList("/home/amira/runtime/uploads/report");
// Create a selection component
Select select = new Select ("Select file");
for (String fileName : fileDirList) {
select.addItem(fileName);
}
public void uploadSucceeded(SucceededEvent event) {
String userHome = System.getProperty( "user.home" );
String filename = event.getFilename();
// Open the file for writing.
file = new File(userHome+"/runtime/uploads/report/"+filename);
String fileName = filename.substring(0,filename.length()-4 );
fileDirList.add(fileName);
}
};
上传文件并在 fileDirList 中添加名称后下拉列表未更新的问题。那么如何刷新呢