Vaadin非常非常新。通過研究Github和其他文檔,我正在使用Spring-security,Vaadin,Maven來設置項目。文件上傳和下載vaadin
我用spring安全項目創建了樣本vaadin-maven。現在我得到登錄頁面,然後在suucessful登錄後,得到一些MainView.java。
我正在嘗試更改上傳的.xls文件並讀取該文件並執行一些功能,然後下載彈出窗口。
我按照http://demo.vaadin.com/sampler/#ui/data-input/other/upload,但錯誤。無法重現我的輸出。現在,我能夠使用路徑讀取文件「final String FILE_PATH =」F://input.xls「;」但是,我需要選擇上傳文件,然後使用該文件獲得更多功能。
功能完成後,我需要下載該文件。
請建議我如何瀏覽文件並上傳並使用上傳的文件進行一些讀寫操作,然後下載Vaadin。
我已經不眠之夜了。請建議我怎樣才能出來這個。 這是我的代碼:
@Component
@Scope("prototype")
@VaadinView(RoleAdminView.NAME)
@Secured("ROLE_ADMIN")
public class RoleAdminView extends Panel implements View
{
public static final String NAME = "role_admin";
@PostConstruct
public void PostConstruct()
{
LoggerFactory.getLogger(this.getClass()).debug("POST");
setSizeFull();
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(true);
layout.setMargin(true);
layout.addComponent(new Button());
layout.addComponent(new Label("ROLE_ADMIN"));
layout.addComponent(new Link("Go back", new ExternalResource("#!" +
MainView.NAME)));
setContent(layout);
}
@Override
public void enter(ViewChangeListener.ViewChangeEvent event)
{
}
}
非常感謝您提前。希望你們理清我的問題:)
請出示您的用於處理上傳的代碼。您將需要存儲文件serverside進行處理。如果它在內存中或臨時文件取決於您的要求 –
感謝您的回覆@AndréSchild。我不知道如何處理vaadin中的上傳文件。我剛剛創建了root.addComponent(new upload());.我卡在這裏。我無法進一步移動:( – user3599302
http://demo.vaadin.com/sampler/#ui/data-input/other/upload我使用了源代碼並添加了代碼,在lineBreaker上出現錯誤,等等。我不知道如何移動,請讓我的一天免費@AndréSchild:( – user3599302