首页 > 其他 > 详细

com.transfer.www

时间:2014-04-10 10:34:54      阅读:440      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
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);
    }

}
bubuko.com,布布扣

 

com.transfer.www,布布扣,bubuko.com

com.transfer.www

原文:http://www.cnblogs.com/MarchThree/p/3655500.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!