jsp中在哪里改写URL模式设置

package com.servlet;


import java.io.IOException;

import java.io.PrintWriter;


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 LoginServlet

 */

@WebServlet("/Judge")

public class LoginServlet extends HttpServlet {

protected void processRequest(HttpServletRequest request, HttpServletResponse response)throws ServletException,IOException{

response.setContentType("text/html;charset=gbk");

PrintWriter out =response.getWriter();

String userid =request.getParameter("userid");

String password =request.getParameter("password");

if((userid.equals("admin"))&&(password.equals("test"))){

RequestDispatcher dispatcher =getServletConfig().getServletContext().getRequestDispatcher("/loginSuccess");

dispatcher.forward(request,response);

}else{

RequestDispatcher dispatcher =getServletConfig().getServletContext().getRequestDispatcher("/loginFail");

dispatcher.forward(request,response);

}

}

       

   

/**

* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)

*/

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

// TODO Auto-generated method stub

processRequest(request,response);

}


/**

* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)

*/

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

// TODO Auto-generated method stub

processRequest(request,response);

}


}


叶子
浏览 1174回答 1
1回答

rookie2maven

你是指<url-pattern> ,在web.xml
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java
JavaScript