Author
javabean problem
Aris Doxakis
Ranch Hand
Joined: Dec 05, 2004
Posts: 136
posted Mar 15, 2005 12:23:00
0
here is my Customer.class package estore; import java.sql.*; import java.io.*; import java.util.*; public class Customer { private String FName; private String LName; private String Address; private String City; private String Country; private String Zipcode; private String Telephone; private String EMail; private int Customer_ID; public Customer(int Customer_ID,String FName,String LName,String Address,String City, String Country,String Zipcode,String Telephone,String EMail) { this.Customer_ID = Customer_ID; this.FName = FName; this.LName = LName; this.Address = Address; this.City = City; this.Country = Country; this.Zipcode = Zipcode; this.Telephone = Telephone; this.EMail = EMail; } public int getCustomer_ID() { return Customer_ID; } public void setCustomer_ID(int id) { Customer_ID = id; } public String getFName() { return FName; } public void setFName(String fn) { FName = fn; } public String getLName() { return LName; } public void setLName(String ln) { LName = ln; } public String getAddress() { return Address; } public void setAddress(String addr) { Address = addr; } public String getCity() { return City; } public void setCity(String cit) { City = cit; } public String getCountry() { return Country; } public void setCountry(String countr) { Country = countr; } public String getZipcode() { return Zipcode; } public void setZipcode(String zc) { Zipcode = zc; } public String getTelephone() { return Telephone; } public void setTelephone(String tele) { Telephone = tele; } public String getEMail() { return EMail; } public void setEMail(String em) { EMail = em; } private boolean ValidateFields() { //String FName = Customer.getFName(); //String LName = Customer.getLName(); //String Address = Customer.getAddress(); //String City = Customer.getCity(); //String Country = Customer.getCountry(); //String Zipcode = Customer.getZipcode(); //String Telephone = Customer.getTelephone(); //String Email = Customer.getEMail(); if ((FName.equals("")) | (LName.equals("")) | (Address.equals("")) | (Country.equals("")) | (Telephone.equals("")) | (EMail.equals("")) | (City.equals("")) | (Zipcode.equals(""))) return false; else return true; } private void CreateCustomer() throws ClassNotFoundException ,SQLException ,IOException { Class.forName("org.gjt.mm.mysql.Driver"); Connection con = null; try { con = DriverManager.getConnection("jdbc:mysql://localhost:3306/e_store"); Statement stmt = con.createStatement(); String insertCustomer = "Insert into Customers (Customer_ID,FName,LName,Address,Country,City,Telephone,Zipcode,EMail) " + "Values( 'm + 1'," + "'" + FName + "','" + LName + "','" + Address + "','" + Country + "','" + City + "','" + Telephone + "'" + FName + "','" + EMail + "');"; stmt.executeUpdate(insertCustomer); stmt.close(); } finally { if (con != null) con.close(); } } } and here my jsp page that uses the class <%@ page import="java.util.Date, java.sql.*, java.util.*" %> <%@ page contentType="text/html; charset=iso-8859-7" %> <jsp:useBean id="newcust" class="estore.Customer" scope="page"/> <jsp:getProperty name="newcust" property="ValidateFields"/> <jsp:getProperty name="newcust" property="CreateCustomer"/> "<"html">" "<"head">" "<"title">"���� ������� -- Registration"<"/title">" "<"/head">" "<"body">" "<"% if (request.getParameter("Submit") != null) { if (ValidateFields()) { CreateCustomer(); } } %">" something isnt working right tomcat returns an error --> information on ValidateFields method not found something like that any help thnx!!!
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56168
posted Mar 15, 2005 12:31:00
0
Aris, do not post the same question more than once. It'll just be confusing to anyone trying to help you. Please continue any discussion in your original post .
[Smart Questions ] [JSP FAQ ] [Books by Bear ] [Bear's FrontMan ] [About Bear ]
subject: javabean problem