在运行jsp时出现了下面的问题,有知道怎么解决的吗
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="java.sql.*"%>
<%@ page import="com.sun.corba.se.impl.orb.PrefixParserAction" %>
<%@ page import="com.microsoft.sqlserver.jdbc" %>
<span class="hljs-keyword">SQL</span> <span class="hljs-keyword">Server</span> <span class="hljs-number">2019</span>
<%
try
{
Class.forName("com.mysql.jdbc.Driver"); //加载MYSQL JDBC驱动程序
//Class.forName("org.gjt.mm.mysql.Driver");
System.out.println("成功加载Mysql驱动程序!");
}
catch (Exception e)
{
System.out.print("加载Mysql驱动程序时出错!");
e.printStackTrace();
}
try
{
Connection connect = DriverManager.getConnection( "jdbc:mysql://localhost:3306/user","root","123");
//连接URL为 jdbc:mysql//服务器地址/数据库名 ,后面的2个参数分别是登陆用户名和密码
System.out.println("成功连接Mysql服务器!");
Statement stmt = connect.createStatement();
ResultSet rs = stmt.executeQuery("select * from user"); //user 为你表的名称
while (rs.next())
{
System.out.println(rs.getString("username"));
}
connect.close();
}
catch (Exception e)
{
System.out.print("获取数据错误!");
e.printStackTrace();
}
%>
发代码结构,和web.xml 配置
和这个页面没关系