zoukankan      html  css  js  c++  java
  • com.transfer.www

    package com.transfer.www;
    
    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;
    import javax.servlet.http.HttpSession;
    
    public class TransferServlet extends HttpServlet {
    
        /**
         * The doGet method of the servlet. <br>
         * 
         * 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 {
    
            String referer = request.getHeader("referer");
            if(referer == null){
                response.sendRedirect(request.getContextPath() + "/index.jsp");
                return;
            }
    
            String option = request.getParameter("myoption");
            if (option.equals("code")) {
    
                request.getRequestDispatcher("/WEB-INF/jsp/code.jsp").forward(
                        request, response);
                return;
            } else {
                response.sendRedirect(request.getContextPath() + "/index.jsp");
                return;
            }
    
        }
    
        public void doPost(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
    
            this.doGet(request, response);
        }
    
    }
  • 相关阅读:
    正则判断是否为纯数值
    前后端加密解密crypto.js
    小程序使用iconfont字体图标
    LeetCode-Combination Sum II
    LeetCode-Combination Sum
    Google 2013 campus test-R1
    Google Codejam
    LeetCode-Count and Say
    LeetCode-Binary Tree Level Order Traversal II
    LeetCode-Binary Tree Level Order Traversal
  • 原文地址:https://www.cnblogs.com/MarchThree/p/3655500.html
Copyright © 2011-2022 走看看