Visualizzazione dei risultati da 1 a 5 su 5
  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2001
    Messaggi
    532

    JSP internal error

    Incontro questo tipo di errore in explorer richiamando
    test.jsp: (altri file già funzionano con il web server)

    errore:

    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.

    test.jsp è:

    <%@ page session="false" %>
    <%@ page import="java.sql.*, java.util.* %>
    <html>
    <head>
    <title>Titolo</title>
    </head>
    <body>
    <%
    string Driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    Class.forName(Driver);
    // database nella stessa cartella di pagina test.jsp
    string URL = "dba.mdb";
    string strcon = "jdbcdbcriver={Microsoft Access Driver (*.mdb)};DBQ="+URL;

    connection con = null;
    con=DriverManager.getConnection(strcon, "", "");

    string sql = "SELECT ragione_sociale, indirizzo FROM Clienti";
    Statement stmt =con.createStatement();
    ResultSet rs = stmt.executeQuery(sql);
    %>

    Titolo della tabella


    <table width="50%" border="10">
    <tr>
    <th>Ragione_sociale</th>
    <th>Indirizzo</th>
    </tr>
    <%
    while (rs.next()) {
    String ragione_sociale = rs.getString(1);
    String indirizzo = rs.getString(2);
    %>
    <tr>
    <td><%= ragione_sociale%></td>
    <td><%= indirizzo%></td>
    </tr>
    <%
    }
    rs.close;
    rs=null;

    stmt.close();
    stmt=null;

    con.close();
    %>
    </table>
    </body>
    </html>





    Cosa sbaglio?

  2. #2
    mancano le virgolette
    <%@ page import="java.sql.*, java.util.*" %>

  3. #3
    Utente di HTML.it
    Registrato dal
    Oct 2001
    Messaggi
    532
    Serve attivare odbc in windows XP per una connessione ad access?

    Continuo a non capire,

    l'errore è:


    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: 11 in the jsp file: /example/lettura3.jsp
    Generated servlet error:
    Syntax error on tokens, delete these tokens

    An error occurred at line: 43 in the jsp file: /example/lettura3.jsp
    Generated servlet error:
    Syntax error, insert "AssignmentOperator ArrayInitializer" to complete Expression


    org.apache.jasper.compiler.DefaultErrorHandler.jav acError(DefaultErrorHandler.java:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacEr ror(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateCla ss(JDTCompiler.java:409)
    org.apache.jasper.compiler.Compiler.compile(Compil er.java:288)
    org.apache.jasper.compiler.Compiler.compile(Compil er.java:267)
    org.apache.jasper.compiler.Compiler.compile(Compil er.java:255)
    org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:563)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:293)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)

    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.12 logs.

    ____________________


    il codice è:




    <%@ page language="java" %>
    <%@ page session="false" %>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.util.*" %>
    <html>
    <head>
    <title>La palestra di JSP</title>
    </head>

    <body>
    <%

    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

    String URL = "/dba.mdb";
    String strcon = "jdbcdbcriver={Microsoft Access Driver (*.mdb)};DBQ="+URL;

    Connection con = null;
    con=DriverManager.getConnection(strcon, "", "");

    String sql = "SELECT ragione_sociale, indirizzo FROM Clienti";
    Statement stmt =con.createStatement();
    ResultSet rs = stmt.executeQuery(sql);*/
    %>

    Titolo della tabella


    <table width="50%" border="10">
    <tr>
    <th>Ragione_sociale 1</th>
    <th>Indirizzo 1</th>
    </tr>
    <%
    while (rs.next()) {
    String ragione_sociale = rs.getString(1);
    String indirizzo = rs.getString(2);

    %>
    <tr>
    <td><%=ragione_sociale%></td>
    <td><%=indirizzo%></td>
    </tr>
    <%
    }
    rs.close;
    rs=null;

    stmt.close();
    stmt=null;
    }
    catch(Exception e)
    {
    System.out.println("Error in creating the connection"+e);

    }
    %>
    </table>
    </body>
    </html>

  4. #4
    codice:
    <%@ page language="java" %>
    <%@ page session="false" %>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.util.*" %>
    <html>
    <head>
    <title>La palestra di JSP</title>
    </head>
    
    <body>
    <%
    
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    
    String URL = "/dba.mdb";
    String strcon = "jdbc:odbcriver={Microsoft Access Driver (*.mdb)};DBQ="+URL;
    
    Connection con = null;
    con=DriverManager.getConnection(strcon, "", "");
    
    String sql = "SELECT ragione_sociale, indirizzo FROM Clienti";
    Statement stmt =con.createStatement();
    ResultSet rs = stmt.executeQuery(sql);
    %>
    
    Titolo della tabella
    
    
    <table width="50%" border="10">
    <tr>
    <th>Ragione_sociale 1</th>
    <th>Indirizzo 1</th>
    </tr>
    <%
    while (rs.next()) {
    String ragione_sociale = rs.getString(1);
    String indirizzo = rs.getString(2);
    
    %>
    <tr>
    <td><%=ragione_sociale%></td>
    <td><%=indirizzo%></td>
    </tr>
    <%
    }
    rs.close();
    rs=null;
    
    stmt.close();
    stmt=null;
    }
    catch(Exception e)
    {
    System.out.println("Error in creating the connection"+e);
    
    }
    %>
    </table>
    </body>
    </html>
    c'era un */ di troppo e rs.close lo puoi fare in vbscript ma in java devi fare rs.close();

  5. #5
    Utente di HTML.it
    Registrato dal
    Oct 2001
    Messaggi
    532
    grazie ora funge

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.