我写了断JSP代码如下:
<%
Connection conn = null;
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String strConn="jdbc:sqlserver://localhost:1433;DatabaseName=Mtesst";
String strUser="sa";
String strPassword="111";
conn=DriverManager.getConnection(strConn,strUser,strPassword);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from tb_employee";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
您的第一个字段内容为:<%=rs.getString(1)%>
您的第二个字段内容为:<%=rs.getString(2)%>
<%}%>
<%out.print("数据库操作成功,恭喜你");%>
<%rs.close();
stmt.close();
conn.close();
%>
可以正常运行,但是为什么在顶部加入
<%@ page import="mondrian.olap.*"%>
就不能正常运行了?
错误提示是:
type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 10 in the jsp file: /test.jsp
The type Connection is ambiguous
7: <body>
8:
9: <%
10: Connection conn = null;
11:
12: Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
13:
<%
Connection conn = null;
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String strConn="jdbc:sqlserver://localhost:1433;DatabaseName=Mtesst";
String strUser="sa";
String strPassword="111";
conn=DriverManager.getConnection(strConn,strUser,strPassword);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from tb_employee";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
您的第一个字段内容为:<%=rs.getString(1)%>
您的第二个字段内容为:<%=rs.getString(2)%>
<%}%>
<%out.print("数据库操作成功,恭喜你");%>
<%rs.close();
stmt.close();
conn.close();
%>
可以正常运行,但是为什么在顶部加入
<%@ page import="mondrian.olap.*"%>
就不能正常运行了?
错误提示是:
type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 10 in the jsp file: /test.jsp
The type Connection is ambiguous
7: <body>
8:
9: <%
10: Connection conn = null;
11:
12: Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
13:
楼主【ls_thy】截止到2008-07-14 20:24:17的历史汇总数据(不包括此帖):
发帖的总数量:0 发帖的总分数:0 每贴平均分数:0
回帖的总数量:0 得分贴总数量:0 回帖的得分率:0%
结贴的总数量:0 结贴的总分数:0
无满意结贴数:0 无满意结贴分:0
未结的帖子数:0 未结的总分数:0
结贴的百分比:---------------------结分的百分比:---------------------
无满意结贴率:---------------------无满意结分率:---------------------
如何结贴请参考这里:http://topic.csdn.net/u/20080501/09/ef7ba1b3-6466-49f6-9d92-36fe6d471dd1.html