Pushing data into my database through JSP giving me ClassNotFoundException, while parsing data from main method is working just fine.
I have my mysql-connector jar and everything in place,
In the following class there are few methods for opening/closing database connections.
package com.socialhub.dao;
import java.sql.Connection;
import java.sql.DriverManager;
public class DBConnection {
    public static int client = 0;
    public static Connection getConnection() {
        Connection con = null;
        try {
            Class.forName("com.mysql.jdbc.Driver");
            con = DriverManager.getConnection("jdbc:mysql://localhost:3306/socialhub","root","root");
            client++;
        } catch (Exception e) {
            System.out.println("Connection issue " + e.getMessage());
            e.printStackTrace();
        }
        return con;
    }
    public void closeConnection(Connection conn) {
        try {
            conn.close();
            client--;
        } catch (Exception e) {
            System.out.println("Connection Close Issue" + e.getMessage());
        }
    }
    public int getClient() {
        return client;
    }
}
<%@ page import="com.socialhub.action.Service"%>  
<% 
String username=request.getParameter("uname");
String fullname=request.getParameter("fname");
String password=request.getParameter("password");
String country=request.getParameter("country");
String gender=request.getParameter("gender");
Service service=new Service();
String message="";
int valid=0;
try {
 country.length();
}
catch(Exception e) {
 country="na";
}
if(country.equalsIgnoreCase("na")||country.equalsIgnoreCase("null")||country==null) {
 message="Invalid Username and Password";
 valid=service.checkcredential(username,password);
 if(valid==0) {
  response.sendRedirect("profile.jsp");
 } else {
     response.sendRedirect("login.jsp?message="+message);
 }
}
else {
 valid=service.save(fullname, country, gender, username, password);
 if(valid==1) {
  message="Registration Successfully completed";
  response.sendRedirect("login.jsp?message="+message); 
 }
 else {
  message="Some Server Error";
  response.sendRedirect("login.jsp?message="+message); 
 }
}
%>