| Author |
browser returning error
|
Anand Shrivastava
Ranch Hand
Joined: Jul 22, 2007
Posts: 125
|
|
i have made the following jsp page <jsp:directive.page import="java.sql.*" /> <jsp:scriptlet> try { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con = DriverManager.getConnection("jdbc racle ci:@xe","hr","hr"); Statement stmnt = con.createStatement(); ResultSet rs=stmnt.executeQuery("select * from countries"); rs.first(); String country = rs.getString("COUNTRY_NAME"); statement.close(); connection.close(); } catch (Exception E) {out.println(E.getmessage());} </jsp:scriptlet> <HTML> <HEAD> <TITLE> </TITLE> </HEAD> <BODY> </BODY> BUT THE BROWSER from tomcat RETURNS THE FOLLOWING ERROR org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 2 in the jsp file: /connection.jsp statement cannot be resolved 1: <jsp:directive.page import="java.sql.*" /> 2: <jsp:scriptlet> 3: try { 4: Class.forName("oracle.jdbc.driver.OracleDriver"); 5: Connection con = DriverManager.getConnection("jdbc racle ci:@xe","hr","hr"); KINDLY HELP.
|
Anand Shrivastava
SCJA
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56168
|
|
|
Why are you using the JSP XML document format in your JSP?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Anand Shrivastava
Ranch Hand
Joined: Jul 22, 2007
Posts: 125
|
|
|
learnt it from [URL=http://www.ibm.com/developerworks/java/library/j-webdata/
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56168
|
|
The JSP document format is not suitable for hand coding. It is primarily intended for the container to use as an intermediary representation of a page, or for when JSP pages are autogenerated from code where a DOM can be built and serialized. I'd strongly suggest just using the "normal" JSP syntax. Trying to use the document sytnax will just yield a frustrating series of errors trying to get the very strict markup just right.
|
 |
Anand Shrivastava
Ranch Hand
Joined: Jul 22, 2007
Posts: 125
|
|
|
tell me exactly how it should be done. I am very new to jsp and this is my first jsp.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56168
|
|
You'll need to find a good book or tutorial on JSP. One that covers JSP 2.0. You should probably also read this article to make sure you understand what JSP is fomr the start.
|
 |
 |
|
|
subject: browser returning error
|
|
|