春罗Excel视图
我正在尝试输出 Excel 文件作为 Spring Roo 1.0.2 中的视图 最快的方法是什么? (我必须添加新的映射等吗?)目前我正在使用默认的 Roo AjaxUrlBasedViewResolver。
谢谢
I am trying to output an Excel file as the view in Spring Roo 1.0.2
What is the quickest way to do this?
(Do I have to add new mapping etc?) At the moment I am using the default Roo AjaxUrlBasedViewResolver.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为有一个特定的“Roo”方法可以做到这一点,但 Spring MVC 确实有一个使用 Apache POI 的 AbstractExcelView 类,并且不会引起任何问题 - 我认为这是您可以期望的最好的方法。
首先创建一个扩展 AbstractExcelView 并实现 buildExcelDocument 方法的视图类:
然后将以下内容添加到 webmvc-config.xml 中。我认为这个位置并不重要,但我将其放在列出我的 TilesConfigurer 的部分下方:
最后创建包含以下内容的views-excel.xml:
I don't think there's a specific "Roo" way of doing this, but Spring MVC does have an AbstractExcelView class that uses Apache POI and doesn't cause any problems - I think it's the best you can hope for.
First create a view class that extends AbstractExcelView and implements the buildExcelDocument method:
Then add the following to your webmvc-config.xml. I don't think the position matters, but I have it below the section where my TilesConfigurer is listed:
Finally create views-excel.xml with the following in it: