欢迎来到天天文库
浏览记录
ID:39181111
大小:1.13 MB
页数:21页
时间:2019-06-26
《003-Servlet入门到精通》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Servlet入门介绍ID:SCSJ004-JSP&ServletAServletcallexample7/25/20212AServletsamplepublicclassHelloWorldServletextendsHttpServlet{publicvoidinit()throwsServletException{//Initializationcode...}publicvoiddoGet(HttpServletRequestreq,HttpServletResponseresp)throwsServletException,IOException{}publicvoidd
2、oPost(HttpServletRequestreq,HttpServletResponseresp)throwsServletException,IOException{}publicvoiddestroy()throwsServletException{//Initializationcode...}}publicvoiddoGet(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException{res.setContentType(“text/html”);PrintWritero
3、ut=res.getWriter();out.println("
4、t-name>com.softeem.HelloWorld
5、0215客户端请求与响应过程7/25/20216doGet与doPosthttp://localhost/helloworld为什么浏览器没有任何响应?publicvoiddoPost(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException{res.setContentType(“text/html”);PrintWriterout=res.getWriter();out.println("
6、/TITLE>”);out.println("");out.println("
7、st提交数据是分多次发送到服务器的,比如文件上传,能传送的总数据量大于get方式。publicvoidexecute(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException{res.setContentType(“text/html”);PrintWriterout=res.getWriter();out.println("
此文档下载收益归作者所有