胡涂涂啊 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 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)