第九章 web安全性入门 实训九

第九章 web安全性入门 实训九_第1张图片

SampleServlet.java

package com.demo;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class SampleServlet
 */
@WebServlet("/sample-servlet")
public class SampleServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public SampleServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		RequestDispatcher rd = request.getRequestDispatcher("/jsp/demo.jsp");
		rd.forward(request, response);
		
	}

}

demo.jsp

第九章 web安全性入门 实训九_第2张图片

web.xml

第九章 web安全性入门 实训九_第3张图片



  security-demo
  
    index.html
    index.htm
    index.jsp
    default.html
    default.htm
    default.jsp
  
  
    
      JSP pages
      *.jsp
    
  
  
    
      sample servlet
      /sample-servlet
    
    
      manager
      member
    
    
      NONE
    
  
  
    FORM
    Security Test
    
      /login.jsp
      /error.jsp
    
  

login.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>




登录页面


请输入用户名和口令:

用户名:
密  码:

error.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>




Insert title here


	

对不起,你的用户名和口令不正确!

第九章 web安全性入门 实训九_第4张图片

第九章 web安全性入门 实训九_第5张图片

你可能感兴趣的:(java,web编程技术)