已阅读5页,还剩1页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
MyEclipse 6 实战开发讲解视频入门 5 MyEclipse 6 + Tomcat 6 Servlet 入门开发2007-10-5视频内容:1. 从 / 下载并安装 Tomcat 6 服务器2. 在 MyEclipse 中配置服务器3. 在 MyEclipse 中启动/停止 Tomcat 64. 新建 Web 项目5. 新建静态页面并添加 GET 和 POST 表单6. 创建 FormServlet7. 编写代码将参数读取出来并输出8. 发布并测试运行, 查看发布内容9. 页面输出汉字内容乱码问题解决 + 如何重新发布10. POST 方式表单参数乱码解决11. GET 方式表单参数乱码解决 下载: /download/MyEclipse6_6.exe 9.37 MB 27分06秒 相关代码:web.xml This is the description of my J2EE component This is the display name of my J2EE component FormServlet servlet.FormServlet FormServlet /FormServlet index.jsp form.html form.html !- GET: POST: FormServlet.javapackage servlet;import java.io.IOException;import java.io.PrintWriter;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;public class FormServlet extends HttpServlet /* * Constructor of the object. */ public FormServlet() super(); /* * Destruction of the servlet. */ public void destroy() super.destroy(); / Just puts destroy string in log / Put your code here /* * The doGet method of the servlet. * * This method is called when a form has its tag value method equals to get. * * param request the request send by the client to the server * param response the response send by the server to the client * throws ServletException if an error occurred * throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException request.setCharacterEncoding(GBK); response.setContentType(text/html;charset=GBK); PrintWriter out = response.getWriter(); out .println(); out.println(); out.println( A Servlet); out.println( ); out.print( 您输入的用户名是:); / GET 方式, 编码转换 String username = request.getParameter(username); username = new String(username.getBytes(ISO8859-1), GBK); out.print(username); out.println(, using the GET method); out.println( ); out.println(); out.flush(); out.close(); /* * The doPost method of the servlet. * * This method is called when a form has its tag value method equals to post. * * param request the request send by the client to the server * param response the response send by the server to the client * throws ServletException if an error occurred * throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException / POST 表单参数的乱码解决 request.setCharacterEncoding(GBK); response.setContentType(text/html;charset=GBK); PrintWriter out = response.getWriter(); out .println(); out.println(); out.println( A Servlet); out.println( ); out.print( 您输入的用户名是:); out.print(request.getParameter(username); out.println(, using the POST method); out.println( ); out.println(); out.flush(); out.close(); /*
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- Unit 5 Section A Grammar focus 教学设计 人教版八年级英语下册
- 飞机外勤仪表、电气工安全生产基础知识竞赛考核试卷含答案
- 飞机任务系统装调工安全生产能力水平考核试卷含答案
- 酵母制备工岗前安全演练考核试卷含答案
- 珍珠岩焙烧工岗位成果考核试卷含答案
- 低压电器及元件装配工道德评优考核试卷含答案
- 海藻制碘工冲突解决测试考核试卷含答案
- 有毒有害气体处理工班组管理考核试卷含答案
- 数据库测试试题及答案
- 三基综合试题及答案超声
- 义务教育数学课程标准(2022年版)练习题及答案
- 97G329-8建筑抗震结构详图(钢筋砼柱单层厂房)图集
- 省级行业产教融合共同体申报书、申报书、参与建设证明
- JJG 241-2002精密杯形和U形液体压力计
- T-SHNA 0003-2023 消化内镜诊疗前消化道准备
- DB21-T 2819-2017岩土工程勘察报告编制规范
- 幼儿教育学心理学复习资料
- JGT266-2011 泡沫混凝土标准规范
- (完整版)医疗器械网络交易服务第三方平台质量管理文件
- 深圳市社会保险定点医疗机构医疗服务协议书共207课件
- 脐灸专业知识课件
评论
0/150
提交评论