胡涂涂啊 2021-04-25 18:43 采纳率: 100%
浏览 38
已采纳

粗体下划线报错 Multiple annotations found at this line:

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'loginDeal3.jsp' starting page</title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
<!-- 引入jar包在此处 -->
<%@ page import="java.sql.*"%>
    

  </head>
  
  <body>
  <%
  //1.获取页面的用户,密码
    String name = request.getParameter("userName");
    String pwd = request.getParameter("userPwd");
    //2.数据库连接
     //**************重复使用代码区域可是********************
      //2.1:将mysql的驱动类放到驱动类管理器(管理中心)进行注册
          Class.forName("com.mysql.jdbc.Driver");
          //2.2:链接mysql,需要必备三个参数:数据库位置,登录账号,登录密码
          String url="jdbc:mysql://localhost:3306/stu2db";
          String user="root";
          String password="root";
          //2.3:获得链接connection
          Connection conn = DriverManager.getConnection(url,user,password);
          //2.4编写sql查询语句,写法为:
          String sql="selct * from tbuser Where nama=? and password= ?";
          //2.5执行获取的preparedstatemment对象
          PreparedStatement pst = conn.prepareStatement(sql);
          //2.6给占位符?处赋值
          pst.setObject(1,name);
          pst.setObject(1,pwd);
          //2.7执行查询,返回结果集
         ResultSet rs=pst.executeQuery();
         //*********重复使用代码区域结束*****************
         //3.判断用户是否合法
          While (rs.next()); {
           //获取rs中的用户,密码
         String rs_Name=rs.getString("name");
          String rs_pwd= rs.getString("password");
          //校验合法性   

         if(name.equals(rs_name)&& pwd.equals(rs_pwd)) {
          out.print("<script> window.alert('登录成功');</script>");
          out.print("<script> window.location.href='main.jsp';('登录成功');</script>");
          }else{
          out.print("<script> window.alert('登录失败');</script>");
          out.print("<script> window.location.href='login.jsp';('登录失败');</script>");
          }
           
           }
          
       
         
  
  
   %>
    
         
     
  </body>
</html>

  • 写回答

3条回答 默认 最新

  • 关注

    查看一下后台是不是引入了多个数据库连接的jar包

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 请问如何在openpcdet上对KITTI数据集的测试集进行结果评估?
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路
  • ¥15 phython读取excel表格报错 ^7个 SyntaxError: invalid syntax 语句报错