已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2027年上半年教育培训服务采购合同三篇
- 2026年商圈跑盘测试题及答案
- 2026年生物考试测试题及答案
- 2026年高考物理碰撞测试题及答案
- 2026广东肇庆市怀集县教育局招聘学科教师87人(编制)备考题库附参考答案详解【培优A卷】
- 2026杨浦区教育系统实习教师培养计划正式启动笔试题库附完整答案详解(夺冠系列)
- 2026广东江门市应急救援支队专职应急救援员招聘参考题库附答案详解
- 2026中国五矿集团有限公司暑期实习生招募笔试历年难易错考点试卷带答案解析
- 2025陕西建工第四建设集团有限公司招聘122人笔试历年常考点试题专练附带答案详解
- 2025湖北武汉出版集团有限公司招聘10人笔试历年常考点试题专练附带答案详解
- 肉毒素需要管理制度
- 广州开放大学2024年《区域经济学》形考作业1-4终考
- CJ/T 184-2012不锈钢衬塑复合管材与管件
- 工装模具管理制度
- 饭店厨房装修合同模板
- 汽车维修安全生产综合应急预案
- DL-T5394-2021电力工程地下金属构筑物防腐技术导则
- 提升数字素养与信息技术应用课件
- 内江市2019-2020学年度第一学期期末考试初中八年级数学试题
- 深圳版小学1-6年级英语词汇表
- 中枢神经系统(医学影像学)
评论
0/150
提交评论