Click here to Skip to main content
11,495,049 members (58,531 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: Javascript Java SQL
friends i am new to java i am working on jsp so i want to insert in database it is showing this error , so how can i solve it can any one help me please... following error is occuring?
In this file i am getting parameters and initilizing beans
<%@page import="com.dryclean.web.controller.AdduserBeans;"%>
<%@page import="com.dryclean.web.controller;" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
AdduserBeans addCust_obj=new AdduserBeans();

public static void SaveCustomer(AdduserBeans adduser)throws Exception
		String dbUrl = "jdbc:mysql://localhost:3306/";
		String db = "dry_cleaner";
		String driver = "com.mysql.jdbc.Driver";
		String user = "root";
		String pass = "";
		Connection con = null;
		Statement stmt = null;
		String query="INSERT INTO customers (customer_id, first_name,last_name,contact,address) VALUES('null','"+adduser.getCustomer_fname()+"','"+adduser.getCustomer_lname()+"','"+adduser.getCustomer_cellnumber()+"','"+adduser.getCustomer_address()+"')";
			con = DriverManager.getConnection (dbUrl+db,user,pass);
			stmt = con.createStatement();
				   System.out.print("Records inserted");
				   System.out.print("insertion faild");
		}catch(Exception ex){
			System.out.println("Query :"+query);
			throw new Exception("Query Error");

and it is showing this error

An error occurred at line: 5 in the jsp file: /addcustomer_do.jsp
AdduserBeans cannot be resolved to a type
2: <%@page import="com.dryclean.web.controller;" %>
3: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
4: <%
5: AdduserBeans addCust_obj=new AdduserBeans();
6: addCust_obj.setCustomer_fname(request.getParameter("add_customer_fname"));
7: addCust_obj.setCustomer_lname(request.getParameter("add_customer_lname"));
8: addCust_obj.setCustomer_address(request.getParameter("add_customer_cellnumber"));
Posted 15-Aug-12 22:57pm
Edited 15-Aug-12 23:08pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I added some format to the question and some tags.

Seems like the AdduserBeans is not known - is it added to the build? Check the build files, the AdduserBeans might not be marked to be added to the build.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Dnyaneshwar@Pune 692
1 Sergey Alexandrovich Kryukov 350
2 CHill60 318
3 Sascha Lefèvre 280
4 Nakul Chaudhari 236
0 Sergey Alexandrovich Kryukov 10,297
1 OriginalGriff 8,821
2 Sascha Lefèvre 3,864
3 Maciej Los 3,412
4 Richard Deeming 2,500

Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 16 Aug 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100