Now, i correct all the errors (As you see n the code below), but the jsp-page ist displayed, but without anything written (from html or database.). Can you know why please?
Thank! --- Jon Wingfield <[EMAIL PROTECTED]> schrieb: > try > <%= rs.getString(i) %> > instead of > <% = rs.getString(i) %> > > > Bruno Armand wrote: > > > Please i try since one week to become this program > > without error, but without success. Perrhaps can > you > > help me! > > > > I write a jsp-file for calling and saving data > from an > > access existing database which i connect with a > > odbc-driver. > > The adrList.jsp ist in the directory > > c:\eclipse\workspace\projectX\ > > I try to start it from tomcat with > > http://localhost:8080/student. > > The file HelloWorld.jsp in the same directory runs > > without problem. > > > > Please here are: > > 1. The code of the adrList.jsp and > > 2. The displayed errormessage. > > __________________________________- > > 1. > > <html> > > <head> > > <%@ page language="java" import = "java.sql.*" %> > > <%@ page import = "java.lang.*" %> > > <% > > try > > { > > Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String username = ""; String password = ""; String url = "jdbc:odbc:Bruno_Adress_odbc"; Connection con = DriverManager.getConnection(url, username,password); > > > > String sql1 = "INSERT INTO Adressen (Nachname, > > Adresse," + > > " Postleitzahl, Land, Ort)" + > > " VALUES ('Bruno Armando', 'Am Vaihingen 20', > > '70187', " + > > "'Deutschland', 'Stuttgart')"; > > > > String sql2 = "INSERT INTO Adressen (Nachname, > > Adresse,"+ > > " Postleitzahl, Land, Ort) " + > > "VALUES ('Becker Marlise', 'Koenigstr 78', > '70174', > > "+ > > "'Deutschland', 'Stuttgart')"; > > > > String query = "SELECT * FROM Adressen"; > > > > Statement stmt = con.createStatement(); > > > > stmt.executeUpdate(sql1); > > stmt.executeUpdate(sql2); > > ResultSet rs = stmt.executeQuery(query); > > ResultSetMetaData rsmd = rs.getMetaData(); > > int columnCount = rsmd.getColumnCount(); > > %> > > > > <title>Details-Adressen von den 5 Besten</title> > > </head> > > <BODY> > > > > <TABLE width='80%' border=0 align='center' > > cellSpacing=5 cellPadding=2 bgcolor="#0000FF" > > bordercolor="#000000"> > > <tr> > > <TD align=left> </TD> > > <TD align=right > > > > > </TD> > > > > <td> Name</td> > > <td> Street</td> > > <td> Zip</td> > > <td> Town</td> > > <td> Country</td> > > </tr> > > > > <% > > while (rs.next()) > > { > > %> > > <tr> > > <TD align=left> </TD> > > <TD align=right > </TD> > > <% > > for (int i = 2; i <= columnCount; i++) > > %> > > <td> > > <%= rs.getString(i) %> > > </td> > > <% > > } > > %> > > </tr><br> > > <% > > } > > rs.close(); > > stmt.close(); > > con.close(); > > } > > catch (SQLException ex) > > { > > System.out.println("SQLException:"); > > while (ex != null) > > { > > System.out.println("SQLState: " + > > ex.getSQLState()); > > System.out.println("Nachricht: " + > > ex.getMessage()); > > System.out.println("Anbieter: " + > > ex.getErrorCode()); > > ex = ex.getNextException(); > > System.out.println(""); > > } } > > %> > > </table> > > </body> > > </html> > > > > 2. Errormessage: > > > > HTTP Status 500 - > > > > type Exception report > > > > message > > > > 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: 106 in the jsp file: > > /adrList.jsp > > > > Generated servlet error: > > [javac] Compiling 1 source file > > > > C:\Programme\Apache Group\Tomcat > > > 4.1\work\Standalone\localhost\student2\adrList_jsp.java:159: > > illegal start of expression > > = rs.getString(i) > > ^ > > > > > > > > An error occurred at line: 14 in the jsp file: > > /adrList.jsp > > > > Generated servlet error: > > C:\Programme\Apache Group\Tomcat > > > 4.1\work\Standalone\localhost\student2\adrList_jsp.java:58: > > 'try' without 'catch' or 'finally' > > try > > ^ > > > > > > > > An error occurred at line: 112 in the jsp file: > > /adrList.jsp > > > > Generated servlet error: > > C:\Programme\Apache Group\Tomcat > > > 4.1\work\Standalone\localhost\student2\adrList_jsp.java:186: > > illegal start of expression > > public static Connection getConnection() > > ^ > > > > > > > > An error occurred at line: 14 in the jsp file: > > /adrList.jsp > > > > Generated servlet error: > > C:\Programme\Apache Group\Tomcat > > > 4.1\work\Standalone\localhost\student2\adrList_jsp.java:61: > === message truncated === __________________________________________________________________ Gesendet von Yahoo! Mail - http://mail.yahoo.de Logos und Klingeltöne fürs Handy bei http://sms.yahoo.de --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]