Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.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
File 在vaadin布局中显示txt文件_File_Web Applications_Vaadin - Fatal编程技术网

File 在vaadin布局中显示txt文件

File 在vaadin布局中显示txt文件,file,web-applications,vaadin,File,Web Applications,Vaadin,我有一个txt文件,其中包含两段信息(纯文本),我如何在文本区域中显示这些信息。到目前为止我试过了 FileResource file = new FileResource(new File("/path/to/file"); TextArea text = new TextArea(); text.setData(file); 这不起作用方法调用不正确 不要使用方法,而是使用方法。请参阅和中的TextArea主题 这需要一个字符串,因此您必须以字符串形式从文件中读取文本,然后在文本区域使用s

我有一个txt文件,其中包含两段信息(纯文本),我如何在文本区域中显示这些信息。到目前为止我试过了

FileResource file = new FileResource(new File("/path/to/file");
TextArea text = new TextArea();
text.setData(file);
这不起作用

方法调用不正确 不要使用方法,而是使用方法。请参阅和中的
TextArea
主题

这需要一个字符串,因此您必须以字符串形式从文件中读取文本,然后在文本区域使用
setValue()

set/getData()方法允许您保存“私有”数据,而Vaadin不使用这些数据