Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/396.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用vaadin上传图像_Java_Vaadin - Fatal编程技术网

Java 如何使用vaadin上传图像

Java 如何使用vaadin上传图像,java,vaadin,Java,Vaadin,我有一种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/u

我有一种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
组件
?如何实现这一点

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

他们的方法是在html页面中嵌入vaadin

看这里:

我用它。 例如:


您可以使用vaadin upload上载一个启用属性(maxfiles)的图像

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);
    }
});