开发者

wicket download csv "Page expired" error

I am trying to download a csv file on click of a button. I have the following implementation, but the moment I click the button, I get a page expired messag开发者_StackOverflow中文版e

WebResource export = new WebResource() {

        @Override
        public IResourceStream getResourceStream() {
            StringBuffer result = new StringBuffer();

            for(Person person: tmpList){
                result.append(person.toCSV()).append("\n");
            }
            return new StringResourceStream(result, "text/plain");
        }

        @Override
        protected void setHeaders(WebResponse response) {
            super.setHeaders(response);
            response.setAttachmentHeader("person.csv");
        }
    };
    export.setCacheable(false);
    form.add(new ResourceLink("exportLink", export));

my html markup is as follows

<a wicket:id="exportLink"><button class="button">Export</button></a>


The error was because of serialization. one of the classes were not serialized

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜