连接ORACLE后,用浏览器打开JSP页面,提示:Not Found(404)
Not Found (404)
The file that you requested could not be found on this server. If you provided the URL, please check to ensure that it is correct. If you followed a hypermedia link, please notify the administrator of that server of this error.
代码:
<%@ page contentType= "text/html;charset=gb2312 " %>
<%@ page import= "java.sql.* " %>
<html>
<body>
<%Class.forName( "oracle.jdbc.driver.OracleDriver ").newInstance();
String url= "jdbc:oracle:thin:@localhost:1521:ORACLE9I ";
String user= "scott ";
String password= "tiger ";
Connection conn=DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement();
String sql= "select * from emp ";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {
%>
第一个字段内容为: <%=rs.getString(1)%>
第二个字段内容为: <%=rs.getString(2)%>
<%
}
%>
<% out.print( "数据库联接成功,恭喜您! ");%>
<%rs.close();
stmt.close();
conn.close();
%>
</body>
</html>
------解决方案--------------------文件名对否,跳转的action对否?
------解决方案--------------------汗一个。
404是找不到访问页面,跟程序无关
------解决方案--------------------恭喜解决了