aspose file tools*
The moose likes JSP and the fly likes javabean problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

javabean problem

Aris Doxakis
Ranch Hand

Joined: Dec 05, 2004
Posts: 136

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: 61761
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javabean problem