




已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 8.2.5 生物的变异 说课稿-2025-2026学年鲁科版(五四学制)生物八年级下册
- Chapter1 Study tours教学设计-2025-2026学年小学英语6B香港朗文版
- 第三节 DNA通过复制传递遗传信息教学设计-2025-2026学年高中生物浙科版2019必修2 遗传与进化-浙科版2019
- 十六 项脊轩志教学设计-2025-2026学年高中语文高一下册华东师大版
- 2025年中考数学试题分类汇编:圆的有关位置关系(9大考点51题) (第1期)解析版
- 2025年采购与供应链管理岗位职业技能资格知识考试题与答案
- 1.3地球的历史教学设计2023-2024学年高中地理人教版(2019)必修第一册
- 2025年体育学科专业知识教师招聘考试押题卷及答案(一)
- 一年级语文上册 第7单元 课文3 11 项链说课稿 新人教版
- 蓄水池防溺水知识培训课件
- 钢厂脱硫脱硝工艺流程图
- 食品行业标准化管理体系
- 快递驿站合作合同协议
- 街道文体中心管理制度
- 初中历年会考试卷及答案
- T-CNAS 18-2020 成人住院患者跌倒风险评估及预防
- 系统功能使用说明及教程
- 课件:《马克思主义基本原理概论》(23版):第五章 资本主义的发展及其趋势
- 2025年轻型民用无人驾驶航空器安全操控(多旋翼)理论备考试题(附答案)
- 2025年护士执业资格考试题库(精神科护理学专项)护理法律法规试题汇编
- 测绘地理信息从业人员保密知识培训
评论
0/150
提交评论