LXJshu 2016-04-17 02:42 采纳率: 80%
浏览 2439
已采纳

表单提交数据之后,JSP页面获取不到,这是什么问题呢?

<from action="research.jsp" method="post">
请输入你的id号:<input type="text" name="id"><br>
<input type="submit" value="提交">
</from>
<body>

以下是research.jsp页面的内容

你要查询的数据是:
<%
Model model=new Model();
int id=Integer.parseInt(request.getParameter("id"));
User user=model.load(id);
out.print(user.getId()+" "+user.getName()+" "+user.getPassword());
%>

报错信息:
严重: Servlet.service() for servlet [jsp] in context with path [/TestProject] threw exception [java.lang.NumberFormatException: null] with root cause
java.lang.NumberFormatException: null

  • 写回答

1条回答 默认 最新

  • niaonao Java领域优质创作者 2016-04-17 14:14
    关注

    int id = Integer.parseInt(request.getParameter("id").toString());
    你试试

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)
  • ¥15 机器人轨迹规划相关问题