【问题标题】:How to upload a image using vaadin如何使用 vaadin 上传图片
【发布时间】:2013-05-17 06:26:53
【问题描述】:

我有一个下面的 html

<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 Upload component 来做到这一点?我怎样才能做到这一点?

【问题讨论】:

    标签: java vaadin


    【解决方案1】:

    您不能将普通的 html 页面与处理“结果”的 vaadin 混合使用。

    他们的方法是将 vaadin 嵌入到您的 html 页面中。

    看这里:

    https://vaadin.com/de/book/vaadin7/-/page/advanced.embedding.html

    【讨论】:

      【解决方案2】:

      我使用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);
          }
      });
      

      【讨论】:

        【解决方案3】:

        您可以使用 vaadin-upload 上传一张带有属性 (maxfiles) 的图片

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2019-04-04
          • 2020-11-13
          • 2016-07-24
          • 2019-05-30
          • 2015-06-03
          • 1970-01-01
          • 2021-08-02
          • 2019-11-22
          相关资源
          最近更新 更多