File 在vaadin布局中显示txt文件
我有一个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
FileResource file = new FileResource(new File("/path/to/file");
TextArea text = new TextArea();
text.setData(file);
这不起作用方法调用不正确
不要使用方法,而是使用方法。请参阅和中的TextArea
主题
这需要一个字符串,因此您必须以字符串形式从文件中读取文本,然后在文本区域使用setValue()
set/getData()方法允许您保存“私有”数据,而Vaadin不使用这些数据