关闭

Servlet——Session会话技术小实验

标签: javacookie技术服务器servlet
252人阅读 评论(0) 收藏 举报
分类:
<span style="font-size:18px;">package myservlet;
/*
 * Session 会话技术目的是服务器只能服务一个浏览器,防止非法登陆,运行在服务器端;
 */

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Servlet1 extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType("text/html;charset=utf-8");
		PrintWriter out = response.getWriter();
	    String erro= (String)request.getAttribute("error");
	            
		out.println("<form action='/Myservlet/Servlet2' method='post'>");
		out.println("<h1>欢迎登陆</h1>");
		out.println("用户名:<input type='text' name='userid'/><br/>");
		out.println("密  码:<input type='password' name='passwor<pre name="code" class="java"></span>
<span style="font-size:18px;"><span style="font-size:18px;">d'/><br/>");out.println("<input type='submit' value='登陆'>");out.println("验证码<img src=''/>");out.println("</from>"); if(erro!=null){ out.println("<h5 style='color:red'>"+erro+"</h5>"); } }public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { this.doGet(request, response);}}</span>
</span>





0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:3629次
    • 积分:106
    • 等级:
    • 排名:千里之外
    • 原创:7篇
    • 转载:1篇
    • 译文:0篇
    • 评论:0条
    文章分类