yunye 的 JavaBlog

          @see codemouse

          統(tǒng)計(jì)

          留言簿(1)

          閱讀排行榜

          評(píng)論排行榜

          jsp超級(jí)鏈接實(shí)現(xiàn)"目標(biāo)另存為"功能

          jsp:


          <% @?page?language = " java " ?contentType = " text/html;?charset=GB18030 "
          ????pageEncoding
          = " GB18030 "
          %>
          <! DOCTYPE?html?PUBLIC?"-//W3C//DTD?HTML?4.01?Transitional//EN"?"http://www.w3.org/TR/html4/loose.dtd" >
          < html >
          < head >
          < meta? http-equiv ="Content-Type" ?content ="text/html;?charset=GB18030" >
          < title > Insert?title?here </ title >
          </ head >
          < body >
          < a? href ="/test/test.do" > 1322 </ a >
          </ body >
          </ html >

          ?action:


          package ?action;

          import ?java.io.FileOutputStream;

          import ?javax.servlet.http.HttpServletRequest;
          import ?javax.servlet.http.HttpServletResponse;

          import ?org.apache.struts.action.Action;
          import ?org.apache.struts.action.ActionForm;
          import ?org.apache.struts.action.ActionForward;
          import ?org.apache.struts.action.ActionMapping;


          public ? class ?TeAction? extends ?Action? {

          ????
          public ?ActionForward?execute(ActionMapping?mapping,?ActionForm?form,
          ????????????HttpServletRequest?request,?HttpServletResponse?response)?
          throws ?Exception? {
          ????????
          // ?TODO?Auto-generated?method?stub
          ????
          ?????????StringBuilder?sb?
          = ? new ?StringBuilder();
          ?????????sb.append(
          " 1 " );
          ?????????response.addHeader(
          " Content-Disposition " ,? " attachment;?filename=test.txt " );?
          ?????????response.setContentType(
          " application/octet-stream " );?
          ?????????response.setCharacterEncoding(
          " GB2312 " );?
          ?????????response.getWriter().write(sb.toString());?
          ?????????response.flushBuffer();


          ????????
          return ? null ;
          ????}

          }

          posted on 2008-03-22 01:40 yunye 閱讀(919) 評(píng)論(1)  編輯  收藏 所屬分類: jsp

          評(píng)論

          # re: jsp超級(jí)鏈接實(shí)現(xiàn)"目標(biāo)另存為"功能 [未登錄] 2012-05-15 10:26 李四

          目標(biāo)另存為  回復(fù)  更多評(píng)論   

          主站蜘蛛池模板: 丹东市| 文昌市| 福贡县| 吉水县| 北流市| 新源县| 广平县| 平果县| 彭阳县| 霍林郭勒市| 泸州市| 新兴县| 岗巴县| 黔西县| 福贡县| 营山县| 潮安县| 扶余县| 屏边| 门源| 隆回县| 河西区| 邛崃市| 湖州市| 民勤县| 浦北县| 竹北市| 资兴市| 博客| 岱山县| 丹巴县| 包头市| 鄱阳县| 嘉黎县| 屏东市| 长治县| 齐齐哈尔市| 手游| 南昌市| 武夷山市| 濮阳市|