问答详情
源自:3-7 request对象(上)

跳转界面404

</head>

  

  <body>

    <h1>用户注册</h1>

    <hr>

   <form name="regForm" action="request.jsp" method="get">

   <table>

   <tr>

   <td>用户名</td>

   <td><input type="text"name="username"/></td>

   </tr>

   <tr>

   <td>爱好:</td>

 <td>

 <input type="checkbox" name="favorite"value="read">读书

 <input type="checkbox" name="favorite"value="music">音乐

 <input type="checkbox" name="favorite"value="movie">电影

 <input type="checkbox" name="favorite"value="game">游戏

 </td>

 <tr>

 <td colspan="2"><input type="submit" name="提交"/></td>

   </tr>

   </table>

   </form>


  </body>

</html>

</head>

  跳转的request界面

  <body>

  <h1>request内置对象</h1>

  <%

  request.setCharacterEncoding("utf-8") ;

   %>

    用户名:<%=request.getParameter("username") %><br>

    爱好:<%

    String[] favorites=request.getParameterValues("favorite");

    for(int i=0;i<favorites.length;i++){

    out.println(favorites[i]+"&nbsp;&nbsp;") ;

    }

    %>

  </body>

</html>


提问者:慕盖茨4474050 2018-08-06 16:49

个回答

  • cdc66
    2018-09-10 21:30:47

    一样的错误啊,修改tomcat路径也不行


  • 柴犬的凝视
    2018-08-08 16:13:21

    我和你一样的错误