雖然我一直在尋找這些論壇很久,但我終於需要一些幫助; 我試過這個;如何在vaadin中顯示文本文件
FileResource file = new FileResource(new File("https://stackoverflow.com/a/d/r/e/s/s/file"));
TextArea text = new TextArea();
text.setValue(file);
這個;
FileResource file = new FileResource(new File("https://stackoverflow.com/a/d/r/e/s/s/file"));
TextArea text = new TextArea();
text.setValue(file.toString());
而;
FileResource file = new FileResource(new File("https://stackoverflow.com/a/d/r/e/s/s/file"));
TextArea text = new TextArea();
text.setValue(file.getAbosoluteFile().toString());
和其他的是要大顯示;
如何顯示文件
可能重複[如何從文件內容創建Java字符串?](http://stackoverflow.com/questions/326390/how-do-i-create-a-java-string-from一個文件的內容) – shmosel
我不認爲這是重複的,因爲這個問題是關於填充Vaadin組件而不僅僅是一個字符串。 –
嗨@WillPierlot如果任何答案已解決您的問題,請考慮通過點擊複選標記來接受它。這向更廣泛的社區表明,您已經找到了解決方案,併爲答覆者和您自己提供了一些聲譽。沒有義務這樣做。 –