jsp里的form表单问题

原代码:

<body>
    <form action="res.jsp" method = post>
        请输入第一个数:
        <input type = "text" name = "firNum"  size = 6>
    </form>
    <form action="res.jsp" method = post>
    请输入第二个数:
        <input type = "text" name = "secNum"  size = 6>
        <br>
        请选择运算符号:
        <input type = "radio" name = "choice" value = "1">加
        <input type = "radio" name = "choice" value = "2">减
        <input type = "radio" name = "choice" value = "3">乘
        <input type = "radio" name = "choice" value = "4">除
        <br>
        <br>
        <input TYPE = "submit" name = "submit" value = "提交">
    </form>

</body>

这里我创建了两个表单,但是第一个表单没有提交按钮,只有第二个表单有提交按钮。
然后在页面上点击提交的时候就出现了问题。报错如下:
报错
报错上显示没有指针,而且显示错误出现在第40行。然后试了好久都没找到这个问题。
后来室友帮我解决了,他说不应该是两个表单。
第一个表单上的信息没有提交,所以没法用request接收到,然后就会提示四十行有问题。( 却没有说第二个表单里提交的信息有问题)
下面是正确的代码:

<body>
    请输入第一个数:
    <form action="res.jsp" method = post>
        <input type = "text" name = "firNum"  size = 6>
    请输入第二个数:
        <input type = "text" name = "secNum"  size = 6>
        <br>
        请选择运算符号:
        <input type = "radio" name = "choice" value = "1">加
        <input type = "radio" name = "choice" value = "2">减
        <input type = "radio" name = "choice" value = "3">乘
        <input type = "radio" name = "choice" value = "4">除
        <br>
        <br>
        <input TYPE = "submit" name = "submit" value = "提交">
    </form>

</body>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值