@RequestMapping(params = "")用法淺析。

suyu_yuan發表於2016-10-18

例子:

@Controller
@RequestMapping({"/userServlet","/wh/userServlet","/wcq/userServlet","/xwrj/userServlet","/lh/userServlet","/hsq/userServlet","/xwx/userServlet","/jys/userServlet","/cdq/userServlet","/dxhq/userServlet","/fxpg/userServlet"}) 
public class UserServlet extends SuperServlet {


//方法:

@RequestMapping(params = "action=logins")
public void Logins(HttpServletRequest request,HttpServletResponse response)


前段請求如:

<form class="form1" method="post" accept-charset="utf-8" id="form1" name="form1" action="<%=request.getContextPath()%>/userServlet?action=logins">


/userServlet?action=logins中的action=logins為請求字串,

(params = "action=logins")對應該設定。