锘??xml version="1.0" encoding="utf-8" standalone="yes"?>午夜影院在线观看国产主播,久久99精品久久久久久青青日本,欧美在线一区二区三区四http://www.aygfsteel.com/yidishui/category/7153.htmljava 2006騫?鏈堟柊寮濮?)zh-cnFri, 02 Mar 2007 06:44:58 GMTFri, 02 Mar 2007 06:44:58 GMT60jsf Hssf 鍒涘緩騫朵笅杞?M$ Excelhttp://www.aygfsteel.com/yidishui/archive/2006/01/21/28851.html涓婊存按涓婊存按Fri, 20 Jan 2006 18:29:00 GMThttp://www.aygfsteel.com/yidishui/archive/2006/01/21/28851.htmlhttp://www.aygfsteel.com/yidishui/comments/28851.htmlhttp://www.aygfsteel.com/yidishui/archive/2006/01/21/28851.html#Feedback0http://www.aygfsteel.com/yidishui/comments/commentRss/28851.htmlhttp://www.aygfsteel.com/yidishui/services/trackbacks/28851.html鍦╦sf涓氳繃FacesContext璁塊棶涓婁笅鏂囷紱
Hssf閫氳繃 HSSFWorkbook 鍚戣緭鍑烘祦鍐欏叆錛?BR>鍏蜂綋浠g爜錛?BR>
Bean錛?/P>
public class TestBean {
    
public String action() {
        HSSFWorkbook wb 
= new HSSFWorkbook();
        FacesContext context
=FacesContext.getCurrentInstance();
        HttpServletResponse response 
= (HttpServletResponse) context.getExternalContext().getResponse();
        response.reset();
        response.setContentType(
"application/ms-excel");
        
try {
            response.setHeader(
"Content-disposition""attachment;filename="+new String("涓嬭澆Excel.xls".getBytes(),"iso-8859-1"));
            wb.write(response.getOutputStream());
        }
 catch (Exception e1) {
            
// TODO Auto-generated catch block
            e1.printStackTrace();
        }

        FacesContext.getCurrentInstance().responseComplete();
        
return null;
    }

}

浠ヤ笂鍙槸涓涓┖鐨勭畝鍗曠殑Excel 鍏蜂綋鎬庝箞鍒涘緩絎﹀悎欏圭洰瑕佹眰鐨勫弬鐪嬶細HSSF GUIDE錛?BR>faces-config.xml:
<managed-bean>
        
<managed-bean-name>test</managed-bean-name>
        
<managed-bean-class>yds.study.web.TestBean</managed-bean-class>
        
<managed-bean-scope>session</managed-bean-scope>
    
</managed-bean>
jsp錛?BR>
<f:view>
    
<h:form>
        
<h:commandButton id="button" value="涓嬭澆" rendered="true"
            action
="#{test123.action}" />
    
</h:form>
</f:view>

ok榪欐牱灝卞彲浠ヤ簡;)

涓婊存按 2006-01-21 02:29 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 金乡县| 岐山县| 策勒县| 云梦县| 贵定县| 康平县| 大荔县| 肥乡县| 广东省| 毕节市| 乐东| 托克托县| 盐城市| 茌平县| 祁东县| 花莲县| 乌鲁木齐市| 鄂伦春自治旗| 永善县| 荆门市| 绥芬河市| 新平| 杂多县| 叙永县| 乐至县| 永嘉县| 互助| 松溪县| 山阴县| 玉龙| 威宁| 南阳市| 石嘴山市| 遂平县| 甘谷县| 建平县| 遂昌县| 奉新县| 麻城市| 正阳县| 淮南市|