2013-05-17 38 views
0

上傳圖像我有以下類型的HTML如何使用vaadin

<html> 
    <head> 
     <title>Upload a file please</title> 
    </head> 
    <body> 
     <h1>Please upload a file</h1> 
     <form method="post" action="http://localhost:8080/service/uploadFile" enctype="multipart/form-data"> 
      <input type="text" name="name"/> 
      <input type="file" name="file"/> 
      <input type="submit"/> 
      <input type="hidden" name="smallSize" value="50x50"> 
      <input type="hidden" name="mediumSize" value="100x100"> 
      <input type="hidden" name="largeSize" value="150x150"> 
     </form> 
    </body> 
</html> 

我想用Vaadin上傳component做到這一點的?我怎樣才能做到這一點?

回答

0

我用https://vaadin.com/directory#addon/easyuploads它。 例如:

final UploadField uploadField = new UploadField(); 
Button b = new Button("Show value"); 
b.addListener(new Button.ClickListener() {   
    public void buttonClick(ClickEvent event) { 
     Object value = uploadField.getValue(); 
     mainWindow.showNotification("Value:" + value); 
    } 
});