欢迎来到天天文库
浏览记录
ID:51690398
大小:46.50 KB
页数:7页
时间:2020-03-15
《JAVA实验用户登录代码.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、实验结果部分截图:(1)错误的用户名密码(2)错误提示页(3)正确的用户名密码(4)成功页面实验代码:Login部分:importjava.io.IOException;importjava.io.PrintWriter;importjavax.servlet.ServletException;importjavax.servlet.http.HttpServlet;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;publicclassLoginextendsHt
2、tpServlet{/***Constructoroftheobject.*/publicLogin(){super();}/***Destructionoftheservlet.*/publicvoiddestroy(){super.destroy();//Justputs"destroy"stringinlog//Putyourcodehere}/***ThedoGetmethodoftheservlet.**Thismethodiscalledwhenaformhasitstagvaluemethodequalstoget.**@paramrequestthereque
3、stsendbytheclienttotheserver*@paramresponsetheresponsesendbytheservertotheclient*@throwsServletExceptionifanerroroccurred*@throwsIOExceptionifanerroroccurred*/publicvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{response.setContentType("text/html"
4、);response.setCharacterEncoding("gb2312");PrintWriterout=response.getWriter();out.println("");out.println("");out.println("
5、"form1"method="post"action="./loginuser">");out.print("");out.println("用户名:");out.println("");out.println("
6、"ID_PASS">密 码:");out.println("");out.println("
7、; ");out.println("");out.println("
此文档下载收益归作者所有