博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Sevrlet的doPost方法读取不到HTML中form表单的数据
阅读量:3898 次
发布时间:2019-05-23

本文共 550 字,大约阅读时间需要 1 分钟。

今天看完网课在实践的时候发现doPost方法无法读取道html表单数据的值

doPost代码如下:

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("post"); BufferedReader reader = request.getReader(); String line=null; while ((line=reader.readLine())!=null) {
System.out.println(line); } }

html表单代码如下:

运行tomcat服务器再html表单提交数据后发现servlet并没有获取到注册信息

最终发现问题:
html表单中需要添加name属性!
。。。

转载地址:http://hqyen.baihongyu.com/

你可能感兴趣的文章
C语言简单实现日志功能的的题目
查看>>
C 实现的 日志模块
查看>>
C语言实现简单的分级别写日志程序
查看>>
深入理解HTTP Session
查看>>
理解TCP中的三次握手
查看>>
linux session 浅谈
查看>>
Session
查看>>
Emacs 中文学习手册-1
查看>>
Emacs学习笔记(1):初学者的学习计划
查看>>
Emacs学习笔记(13):在Emacs中打开pdf
查看>>
Emacs学习笔记(14):在Emacs中使用git
查看>>
Emacs for vim Users---from http://www.crazyshell.org/blog/
查看>>
静态库和动态库链接那些事--http://www.crazyshell.org/blog/?p=50
查看>>
使用samba实现linux,windows间文件共享
查看>>
多线程调试必杀技 - GDB的non-stop模式
查看>>
一年成为Emacs高手(像神一样使用编辑器) .--http://blog.csdn.net/redguardtoo/article/details/7222501
查看>>
GNU make 指南
查看>>
配置 vim
查看>>
CentOS6.3 minimal SSH中文显示
查看>>
centos 安装emacs24
查看>>