Home > Back-end >  DatabaseConnection always be resolved
DatabaseConnection always be resolved

Time:01-12

HTTP status 500 - internal server error
Type of abnormality report

Message cannot be compiled for JSP classes:

Description the server encountered an unexpected situation, prevent it to complete the request,

Exceptions to the

Org. Apache. Jasper. JasperException: unable to JSP compile classes:

The JSP file: [/check the JSP] is a mistake in the first line [16]
DatabaseConnection always be resolved
13: % & gt;
14: & lt; %
15: String SQL="SELECT the name FROM member WHERE mid='" + mid +"' AND password='" + "+"' ";
16: the Statement STMT.=DatabaseConnection getConnection () createStatement ();
17: the ResultSet rs=STMT. ExecuteQuery (SQL);
18: String name=null;
19: if (rs. Next ()) {//


The JSP file: [/check the JSP] is a mistake in the first line [22]
DatabaseConnection always be resolved
19: if (rs. Next ()) {
20: name=rs. Get string (1);//
21:}
22: DatabaseConnection. Close ();//
23: % & gt;
24: & lt; %
25: if (name==null) {//


Stacktrace:
Org.apache.jasper.com piler. DefaultErrorHandler. JavacError (DefaultErrorHandler. Java: 103)
Org.apache.jasper.com piler. ErrorDispatcher. JavacError (ErrorDispatcher. Java: 213)
Org.apache.jasper.com piler. JDTCompiler. GenerateClass (JDTCompiler. Java: 528)
Org.apache.jasper.compiler.Compiler.com running (392) Compiler. Java:
Org.apache.jasper.compiler.Compiler.com running (362) Compiler. Java:
Org.apache.jasper.compiler.Compiler.com running (346) Compiler. Java:
Org.apache.jasper.JspCompilationContext.com from running (JspCompilationContext. Java: 605)
Org. Apache. Jasper. Servlet. JspServletWrapper. Service (400) JspServletWrapper. Java:
Org. Apache. Jasper. Servlet. JspServlet. ServiceJspFile (JspServlet. Java: 385)
Org. Apache. Jasper. Servlet. JspServlet. Service (329) JspServlet. Java:
Javax.mail. Servlet. HTTP. HttpServlet. Service (HttpServlet. Java: 733)
Org, apache tomcat, websocket server. WsFilter. DoFilter (53) WsFilter. Java:
) : the whole stack information can pay attention to the main problem in the server logs view

Apache Tomcat/9.0.39

CodePudding user response:

The exceptions that you describe your check check. The first [16] JSP lines of code, and see where I went wrong, the code can be glued to come out?

CodePudding user response:

DatabaseConnection should be DriverManager

CodePudding user response:

reference 1/f, gu dye dust response:
see exceptions that you describe your check check. The first [16] JSP lines of code, and see where I went wrong, the code can be glued to come out?

String SQL="SELECT the name FROM member WHERE mid='" + mid +"' AND password='" + "+"' ";

CodePudding user response:

The Statement STMT=DatabaseConnection. GetConnection (). CreateStatement ();

CodePudding user response:

refer to the second floor tianfang response:
DatabaseConnection should be DriverManager
didn't can understand and thank you in a little more detail

CodePudding user response:

reference 5 floor weixin_45779757 reply:
Quote: refer to the second floor tianfang response:
DatabaseConnection should be DriverManager
didn't know it in detail can thank


In general the JDBC using order

The guide into the driver

Class.forname (" driverName ");

And then links database

The Connection conn=DriverManager. GetConnection (url, username, password);

Build SQL statements link
Statment STMT=conn. CreateStatement ();

The query results
The ResultSet rs=STMT. ExecuteQuery (SQL);


This is foundation, a good reading!


If the DatabaseConnection was built their link class, pay attention to the JSP ever import the class,

CodePudding user response:

reference weixin_45779757 reply: 3/f
Quote: reference 1/f, gu dye dust response:
see exceptions that you describe your check check. The first [16] the JSP lines of code, and see where I went wrong, the code can be glued to come out?

String SQL="SELECT the name FROM member WHERE mid='" + mid +"' AND password='" + "+"' ";

Is solid, kids, I mean all the code, but it's all right, 6th floor's answer can solve your problem

CodePudding user response:

refer to 6th floor qq_39936465 response:
Quote: refer to the 5 floor weixin_45779757 response:
Quote: refer to the second floor tianfang response:
DatabaseConnection should be DriverManager
didn't know it in detail can thank


In general the JDBC using order

The guide into the driver

Class.forname (" driverName ");

And then links database

The Connection conn=DriverManager. GetConnection (url, username, password);

Build SQL statements link
Statment STMT=conn. CreateStatement ();

The query results
The ResultSet rs=STMT. ExecuteQuery (SQL);


This is foundation, a good reading!


If the DatabaseConnection was built their link class, pay attention to the JSP ever import the class,

Thank you said so in detail

CodePudding user response:

reference 7 floor of dye dust reply:
Quote: refer to the third floor weixin_45779757 response:
Quote: reference 1/f, gu dye dust response:
see exceptions that you describe your check check. The first [16] JSP lines of code, and see where I went wrong, the code can be glued to come out? nullnullnullnull
  • Related