zoukankan      html  css  js  c++  java
  • koa-router post请求接收的参数为空

    注:koa-router路由和koa-bodyparser中间件  post请求中参数为空。

    页面代码

    <!DOCTYPE html>
    <html>
    <head>
        <title>新增数据</title>
    </head>
    <body>
        <h1><%= title %></h1>
        <form method="post" action="/addCommit">
            <span>名字:</span>
            <input type="text"/>
            <span>描述:</span>
            <input type="text"/>
            <button type="submit">提交</button>
        </form>
    </body>
    </html>

    上面这段代码,试了好多次,参数都接收不到。然后各种百度,找了半个多小时。还是没效果。

    因为学过java 有点java基础  发现上面input输入框少了点 东西 "name"属性,然后就去试了一下。结果是成功了

    <!DOCTYPE html>
    <html>
    <head>
        <title>新增数据</title>
    </head>
    <body>
        <h1><%= title %></h1>
        <form method="post" action="/addCommit">
            <span>名字:</span>
            <input type="text" name="nane"/>
            <span>描述:</span>
            <input type="text" name="message"/>
            <button type="submit">提交</button>
        </form>
    </body>
    </html>

    不过 ,接收不到参数的原因有很多,这只是其中一个原因,而且还是最基础的......

    总结:学习某种新技术时,要学会和其它技术去比较,“去类比“ 。

  • 相关阅读:
    Java 框架
    GridView1 footer求和
    常用CSS
    吉日分页转载
    强制刷新
    常用的CDN 链接 http://cdn.code.baidu.com/ http://www.bootcdn.cn/
    1、C#中Hashtable、Dictionary详解以及写入和读取对比
    webservice 交错数组
    vs plug
    DataReader方式 获取数据
  • 原文地址:https://www.cnblogs.com/Mrrabbit/p/8733162.html
Copyright © 2011-2022 走看看