waterye

在spring应用中生成excel, pdf

参考spring-framework-1.2.5\samples\countries
1. install
1). c:\> ant all
2). copy "dist\countries.war" to "tomat_home\webapps\"
3). http://localhost:8080/countries

2. Getting Started
1). Controller

String excelView = "countries_excelView";
public ModelAndView handleExcel(HttpServletRequest request, HttpServletResponse response) throws ServletException {
        RefreshablePagedListHolder listHolder 
=
                (RefreshablePagedListHolder) request.getSession(
true).getAttribute(COUNTRIES_ATTR);
        
if (listHolder == null{
            
throw new ServletException("No countries list found in session");
        }

        
return new ModelAndView(this.excelView, "countries", listHolder);
    }
2). Excel View
public class CountriesExcelView extends AbstractExcelView {
    
}
3). properties
countries_excelView.class=org.springframework.samples.countries.web.CountriesExcelView

3. 深入了解
org.springframework.web.servlet.view.document.AbstractExcelView (by POI)
org.springframework.web.servlet.view.document.AbstractJExcelView (by JExcelApi)
参考spring-framework-1.2.5\test\org\springframework\web\servlet\view\document

posted on 2005-09-29 12:50 waterye 阅读(2374) 评论(0)  编辑  收藏 所属分类: spring


只有注册用户登录后才能发表评论。


网站导航: