样卷1编程.doc
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《样卷1编程.doc》由会员分享,可在线阅读,更多相关《样卷1编程.doc(17页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、编程1、 base href= My JSP 3_3.jsp starting page =60) RequestDispatcher s=request.getRequestDispatcher(good.jsp); s.forward(request,response); else RequestDispatcher s=request.getRequestDispatcher(bad.jsp); s.forward(request,response); % good.jsp base href= My JSP good.jsp starting page =85&i 你的得分是,优秀!
2、你的得分是,优秀!竟然满分,牛! =75) % 你的得分是,良好 =60) % 你的得分是,及格 bad.jsp base href= My JSP bad.jsp starting page 你的得分是,不及格,要努力了! 8.1文件下载first.javapackage download;import java.io.FileInputStream;import java.io.IOException;import .URLEncoder;import javax.servlet.ServletException;import javax.servlet.ServletOutputStre
3、am;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;public class first extends HttpServlet protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException this.doPost(req, resp
4、); protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException req.setCharacterEncoding(utf-8); resp.setContentType(text/html;charset=utf-8); FileInputStream in=null; ServletOutputStream sos=null; String path=req.getParameter(path); int index=path.las
5、tIndexOf(/); String filename=path.substring(index+1); String newName=URLEncoder.encode(filename,utf-8); String type=path.substring(path.lastIndexOf(.)+1); if(type.equals(doc) resp.setContentType(application/msword); else if(type.equals(pdf) resp.setContentType(application/pdf); elseresp.setContentTy
6、pe(application/vnd.ms-excel); resp.setHeader(content-disposition,attachment;filename=+newName); sos=resp.getOutputStream(); try in=new FileInputStream(path); int i=0; while(i=in.read()!=-1) sos.write(i); catch(Exception e) e.printStackTrace(); finally try sos.close(); in.close(); catch (IOException
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 编程
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内