zoukankan      html  css  js  c++  java
  • javaweb项目中jsp的from表单提交action内容与web.xml的servlet-mapping对应

    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不加"/"

  • 相关阅读:
    mysql远程访问设置
    LUA Userdata
    LUA 面向对象
    LUA table中函数的调用
    LUA 元表
    LUA table
    hibernate3 和hibernate4的一点小变动
    java 关键字final
    MySQL oracle 分页
    Java后端开发书架
  • 原文地址:https://www.cnblogs.com/pengsulong/p/13420112.html
Copyright © 2011-2022 走看看