白白白湫
2019-12-18 21:13
采纳率: 37.5%
浏览 697

my eclipse中用servlet doGet提问,post方法传,收集到答案后传到第三个servlet跳转到jsp报错此URL不支持Http方法GET?

第一个Servlet中doGet中代码
response.setContentType("text/html;charset=utf-8");
request.setCharacterEncoding("UTF-8");
HttpSession session=request.getSession();
PrintWriter out = response.getWriter();
out.println("");
out.println("

问卷");
out.println(" ");
    out.println("<form name=tourside method=post action=Tour3Servlet");
    out.println("  <table>");
    out.println(" <tr>");
    out.println(" <td>你想要去的地方:</td>");
    out.println("<td><input type=text name=side></td><br>");
    out.println("  </tr><br>");
    out.println("  <tr>");
    out.println(" <td>你想要看到什么:</td>");
    out.println("<td><input type=text name=thing></td><br>");
    out.println("  </tr><br>");

    out.println("  <tr>");
    out.println("  <td><input type=reset value=重新输入></td>");
    out.println("  <td><input type=submit value=确定></td>");
    out.println("  </tr>");
    out.println("  </table>");
    out.println("  </BODY>");
    out.println("</HTML>");

    out.close();

第二个Servlet中doPost方法代码
response.setContentType("text/html;charset=utf-8");
request.setCharacterEncoding("UTF-8");
HttpSession session=request.getSession(false);
PrintWriter out = response.getWriter();
String side=request.getParameter("side");
session.setAttribute("side", side);
String thing=request.getParameter("thing");
session.setAttribute("thing", thing);
out.println("");
out.println("

调查信息:");
out.println(" ");
out.print("

汇集:

");
String thing2=thing;
out.println("地点:"+side+"
");
out.println("景象:"+thing2+"

");
out.println("

out.println(" ");
out.println(" ");
out.println(" ");
out.println(" ");
out.println("");
    out.close();

第三个Servlet中doPost方法想要传入到同一工程下的jsp界面
response.setContentType("text/html;charset=utf-8");
response.sendRedirect("http://localhost:8080/SJ/Third.jsp");
在第二个界面点击确定后就报错此URL不支持HTTP的get方法??????

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题