java - struts2 mysql conection error in eclipse -
java - struts2 mysql conection error in eclipse -
i connecting mysql using jdbc jsp, shows error classnotfoundexception
in eclipse in struts jsp page.
validate.java:
package com.demo; import java.sql.*; public class loginvalidate { public boolean validatelogin(){ class.forname("com.mysql.jdbc.driver").newinstance(); connection con=drivermanager.getconnection("jdbc:mysql://localhost:3306/inspioqj_appointment"); homecoming true; } }
same code using in same project jsp file working problem not understanding.
index.jsp:
<%@ page language="java" import="java.sql.*" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <!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=iso-8859-1"> <title>insert title here</title> </head> <body> <p> there home page.</p> <hr/> <a href="login">login</a>| <a href="logout">logout</a>| <a href="profile">profile</a> <% class.forname("com.mysql.jdbc.driver"); connection con=drivermanager.getconnection("jdbc:mysql://localhost:3306/inspioqj_appointment"); %> </body> </html>
i have included mysql java connector on lib folder in eclipse struts project, not working in action controller validate.java is working in index.jsp page.
what problem? not understand.
its pretty simple classnotfoundexception. create sure mysql jar nowadays in class-path of project well. can right-clicking project, configure class-path , there can add together particular jar
java mysql jsp jdbc
Comments
Post a Comment