为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

叶子 2016-11-30 22:36:02
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); }}
查看完整描述

1 回答

?
rookie2maven

TA贡献278条经验 获得超76个赞

你是指<url-pattern> ,在web.xml


查看完整回答
1 反对 回复 2016-12-05
  • 1 回答
  • 0 关注
  • 1173 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信