I am using eclipse, wamp and tomcat to manage a project. I can run my java class and call java class with JSP. But when I use JSP call Java class, SQL in Java class not execute.
My code SQL in Java class
public P_Process() {
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/myproject?autoReconnect=true&useSSL=false",
"root", "");
st = con.createStatement();
} catch (Exception ex) {
System.out.println("Error: " + ex);
}
}
Output :
Table A Get Data Complete!!!!!
names : 1611
Table B Get Data Complete!!!!!
tf_idf2 : 102560
Table C Get Data Complete!!!!!
idf2 : 4804
value of segmentation ............ red|black|
input >>>>>>>> red,black
input size : 2
My code JSP call Java class
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.sample.P_Process"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
P_Process start = new P_Process();
out.print(start.process("red,black"));
%>
</body>
</html>
Output :
Error: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
java.lang.NullPointerException
Table A Get Data Complete!!!!!
names : 0
java.lang.NullPointerException
Table B Get Data Complete!!!!!
tf_idf2 : 0
java.lang.NullPointerException
Table C Get Data Complete!!!!!
idf2 : 0
value of segmentation ............ red|black|
input >>>>>>>> red,black,
input size : 2