login.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>demo</title>
  </head>
  <body>
  <form action="login" method="post">
  user:<input type="text" name="user">
  passsord<input type="password" name="password">
    <input type="submit" name="提交">
  </form>
  </body>
</html>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">
    <servlet>
        <servlet-name>loginServlet</servlet-name>
        <servlet-class>com.psl.loginServlet.LoginServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>loginServlet</servlet-name>
        <url-pattern>/login</url-pattern>
    </servlet-mapping>
</web-app>

注意:action的URI不加"/"

相关文章:

  • 2022-12-23
  • 2021-12-14
  • 2021-08-10
  • 2021-12-24
  • 2021-07-27
猜你喜欢
  • 2021-08-18
  • 2022-02-02
  • 2021-07-11
  • 2021-07-29
  • 2021-04-22
  • 2021-11-10
相关资源
相似解决方案