Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: Cannot resolve Symbol (class) but why? (JSP)

Reply
Thread Tools

Re: Cannot resolve Symbol (class) but why? (JSP)

 
 
sufia
Guest
Posts: n/a
 
      07-03-2003
http://www.velocityreviews.com/forums/(E-Mail Removed) (@lex-kid) wrote in message news:<(E-Mail Removed). com>...
> Hello newsgroup guys.
> I hope you can help me.
> I sat on the script for days and nights and dont find the error.
>
> I first had a JSP Site where you could acces a MS Acces Database with
> Select, Update, and Delete and it all worked fine. As I sayd it was
> all in only one file at the beginning. (Code is below)
>
> Now I want to go a step towards and wanna sepereate the Java Code from
> the JSP into an own class, so I made a seccond file and fit the JSP
> site. (Codes are below).
>
> But what i just get is an error like this:
> Generated servlet error:
> [javac] Since fork is true, ignoring compiler setting.
> [javac] Compiling 1 source file
> [javac] Since fork is true, ignoring compiler setting.
> [javac] C:\Programme\Apache Group\Tomcat
> 4.1\work\Standalone\localhost\jspdb\form_jsp.java: 58: cannot resolve
> symbol
> [javac] symbol : method ladeDBTreiber ()
> [javac] location: class org.apache.jsp.form_jsp
> [javac] ladeDBTreiber();
> [javac] ^
> [javac] 1 error
>
> why cannto resolve symbol?
>
> Here my codes:
> First the first file i had in one jsp file (Sorry the text is german
> but should be a problem).
> <%@ page import = "java.sql.*" %>
> <html>
> <head>
> </head>
> <body bgcolor="white">
> <h1>Wilkommen bei der JSPDB Datenbankverwaltung</h1>
> <%
> String sfindName = request.getParameter("findName");
> String sinsertName = request.getParameter("insertName");
> String sinsertVorname = request.getParameter("insertVorname");
> String sdeleteName = request.getParameter("deleteName");
> String surl = "jdbcdbcerson"; //Pfad zur Datenbank Person
> String suser = "test"; //Username
> String spass = "test"; //Passwort
>
>
> if (sfindName == null && sinsertName == null && sdeleteName == null)
> { %>
> Bitte geben Sie den Suchbegriff ein:
> <form name="Suche" method="post" action="hello.jsp">
> <p><input type="text" name="findName">&nbsp;<input type="submit"
> name="submit" value="&nbsp;Go&nbsp;"></p>
> </form>
>
> <br><br><br>
> Bitte geben Sie den Namen und Vrnamen ein, welchen Sie einfügen
> möchten:
> <form name="Einfügen" method="post" action="hello.jsp">
> <p><table><tr><td><b>Name:</b></td><td><b>Vorname:</b></td></tr>
> <tr>
> <td><input type="text" name="insertName"></td>
> <td><input type="text" name="insertVorname"></td>
> </tr>
> </table>
> <input type="submit" name="submit" value="&nbsp;Go&nbsp;"></p>
> </form>
>
> <br><br><br>
> Bitte geben Sie den zu löschenden Namen ein:
> <form name="Löschen" method="post" action="hello.jsp">
> <p><input type="text" name="deleteName">&nbsp;<input type="submit"
> name="submit" value="&nbsp;Go&nbsp;"></p>
> </form>
> <% }
> else if (sfindName != null) {
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> Connection con1 = DriverManager.getConnection(surl,suser,spass);
> Statement st1 = con1.createStatement();
> ResultSet rs1 = st1.executeQuery("select * from Person where Name =
> '"+ sfindName +"' ");
>
> out.println("Ihre Suche ergab folgende Ergebnisse: <br><br>");
> out.println("<table><tr><td><b>Name</b></td><td><b>Vorname</b></td></tr>");
>
> while(rs1.next())
> {
> out.println("<tr><td>");
> out.println(rs1.getString("Name"));
> out.println("</td><td>");
> out.println(rs1.getString("Vorname"));
> out.println("</td></tr>");
> }
> out.println("</table>");
> rs1.close();
> st1.close();
> con1.close();
> }
>
> else if (sinsertName != null) {
> try{
>
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> Connection con2 = DriverManager.getConnection(surl,suser,spass);
> Statement st2 = con2.createStatement();
>
> st2.executeUpdate("Insert into Person values ('" + sinsertName
> + "','" + sinsertVorname + "')");
>
> out.println("Name und Vorname wurde erfolgreich gesetzt");
>
> con2.close();
> }
>
> catch(java.lang.ClassNotFoundException e){
>
> System.out.println("JDBC-ODBC-Treiber nicht gefunden");
> System.out.println(e.toString());
> }
> catch(java.sql.SQLException e){
>
> System.out.println("Fehler beim Abfragen der
> Datenbank");
> System.out.println(e.toString());
> }
>
> }
>
> else if (sdeleteName != null) {
> try {
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> Connection con3 = DriverManager.getConnection(surl,suser,spass);
> Statement st3 = con3.createStatement();
>
> st3.executeUpdate("delete from Person where Name = '" + sdeleteName
> + "' ");
>
> out.println("Name erfolgreich gelöscht");
> st3.close();
> con3.close();
> }
>
> catch(java.lang.ClassNotFoundException e){
>
> System.out.println("JDBC-ODBC-Treiber nicht gefunden");
> System.out.println(e.toString());
> }
> catch(java.sql.SQLException e){
>
> System.out.println("Fehler beim Abfragen der
> Datenbank");
> System.out.println(e.toString());
> }
> }
> %>
> </body>
> </html>
>
>
>
>
> Now the file second JSP after seperating the most of the Java Code:
> I first just wanna try to start only one method but it even doesnt
> work.
>
> <%@ page import = "Person" %>
> <html>
> <body>
> <head>
> <title>JSP-DB Datenbankverwaltung</title>
> </head>
> <body bgcolor="white">
> <h1> JSP-DB Datenbankverwaltung</h1>
>
> <%
> String sfindName = request.getParameter("findName");
> String sinsertName = request.getParameter("insertName");
> String sinsertVorname = request.getParameter("insertVorname");
> String sdeleteName = request.getParameter("deleteName");
>
> ladeDBTreiber();
>
>
> %>
> </body>
> </html>
>
>
>
>
> And now finally the Java Class, where I also didnt placed all methods
> yet.
>
> import java.sql.*;
> import java.io.*;
> import java.util.*;
> import java.lang.*;
>
>
> public class Person
> {
> String sDBTreiber = "sun.jdbc.odbc.JdbcOdbcDriver";
> String surl = "jdbcdbcerson"; //Pfad zur Datenbank Person
> String suser = "test"; //Username
> String spass = "test"; //Passwort
> Class cl = null;
>
> public void ladeDBTreiber() {
> try
> {
> cl = Class.forName(sDBTreiber);
> }
> catch (java.lang.ClassNotFoundException e)
> {
> System.out.println("JDBC-ODBC Treiber nicht gefunden");
> System.out.println(e.toString());
> }
> }
>
> public void verbindeDatenbank()
> throws SQLException{
> Connection conn = DriverManager.getConnection(surl, suser, spass);
> }
>
> }
>
>
>
>
> I tried so much arround, I dont know whats wrong.
> I changed the import tag, tried to make a package, tried to run just a
> really simple method which only gives out a sentence.
>
> Sorry looks really confused now but I hope you come through it. If not
> just ask and I give more details or something.
> Thansk for helping
> by
> alex



Hey alex,

From what I understood , you cant get any servlet to run. If
that's the case then you might have to install Jakarta. You can find
the latest version on the site
http://jakarta.apache.org/tomcat/
Good luck.
 
Reply With Quote
 
 
 
 
@lex-kid
Guest
Posts: n/a
 
      07-06-2003
....
>
> Hey alex,
>
> From what I understood , you cant get any servlet to run. If
> that's the case then you might have to install Jakarta. You can find
> the latest version on the site
> http://jakarta.apache.org/tomcat/
> Good luck.


Thanks for the info. Well i have Tomcat installed which worked fine
for me. For example the first file, where all code is in one .jsp file
works fine. but not the two seperated.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
src-resolve: Cannot resolve the name ... ivanet@gmail.com XML 1 03-23-2007 12:10 PM
cannot resolve symbol errors Jody Java 1 11-11-2004 05:46 PM
unexpected token / cannot resolve symbol error vivienne wykes Java 4 07-28-2004 06:48 PM
Cannot resolve symbol Jo Java 3 04-10-2004 06:12 PM
Re: Cannot resolve Symbol (class) but why? (JSP) @lex-kid Java 2 07-07-2003 07:26 AM



Advertisments