Win a copy of Rust Web Development this week in the Other Languages forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

javabean problem

 
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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!!!
 
Sheriff
Posts: 67619
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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.
 
    Bookmark Topic Watch Topic
  • New Topic