Java 此url错误和SQL错误不支持Web应用程序提供的http方法

Java 此url错误和SQL错误不支持Web应用程序提供的http方法,java,mysql,jsp,servlets,Java,Mysql,Jsp,Servlets,我正在创建一个web应用程序,当我们访问它时,它会给出一个“此url不支持http方法”;错误,也是一个SQL错误 请让我知道问题出在哪里。有时它会给出一个SQL错误,现在它会给出“此url不支持http方法post”错误 你能提供成功运行它的方法吗 index.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!D

我正在创建一个web应用程序,当我们访问它时,它会给出一个“此url不支持http方法”;错误,也是一个SQL错误

请让我知道问题出在哪里。有时它会给出一个SQL错误,现在它会给出“此url不支持http方法post”错误

你能提供成功运行它的方法吗

index.jsp

 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  pageEncoding="ISO-8859-1"%>
  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"       

   "http://www.w3.org/TR/html4/loose.dtd">
   <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>My Web Project</title>
    <link rel="stylesheet" type="text/css" href="css/style.css">
     <script type="text/javascript" src="js/script.js"></script>
     </head>
    <body>
    <table width="100%" height="15%">
    <tr>
    <td><h2>**My Web Project**</h2>
     <td width="200px"></td>
    <td>
    <form method="post" action="http://localhost:8080/webapp1/login">
     UserName: <input type="text" name="usern" class="textbox">
    Password: <input type="password" name="pass" class="textbox">
    <input type="submit" value="login" class="circle" >
    </form>.....

您已将
doPost
声明为

protected void doPost(HttpServletRequest request, 
                      HttpServletResponse  response, String geek) 
        throws ServletException, IOException 
问题在于您添加的“极客”参数。这会导致方法的签名与标准
doPost
方法签名不匹配。这意味着您正在重载
doPost
,而不是覆盖它

结果是servlet根本不会调用您的
doPost
。相反,它调用您应该重写的方法。。。其行为是说“POST not supported”

解决方案:去掉伪
geek
参数


解决方案2:向方法添加一个
@Override
注释。这将导致编译器告诉您该方法是否不是重写。

警告:不要将密码存储为纯文本。始终使用密码级别的散列系统,如或。因此,您是否已检查是否正在调用doPost方法?建议:阅读
e.printStackTrace()
将写入的日志文件,并查找stacktrace。
protected void doPost(HttpServletRequest request, 
                      HttpServletResponse  response, String geek) 
        throws ServletException, IOException