Insertion into database not possible

Hi All,

i am doing a web project.where i have registration form and i want to enter all the data of the to the database.i have make a bean having the getter and setter for all the variables of string type.i have another bean which have getters and setters for all variables but with correct datatypes.

in my jsp i am receiving an error as

org.apache.jasper.JasperException: Attempted a bean operation on a null object.

but the code is as follows

<jsp:useBean id="employerRegistrationBean" class="org.mkcl.employer.bean.EmployerRegistrationBean" scope="page">

<jsp:setProperty name="employerRegistrationBean" property="*"/>

</jsp:useBean>

<jsp:getProperty property="faxstdcode" name=" employerRegistrationBean"/>

<%! int a,b,c,d; %>

<%!int f,g,h; %>

<% employerRegistration.setUsername(employerRegistrationBean.getUsername());

employerRegistration.setPassword(employerRegistrationBean.getPassword());

a=Integer.parseInt(employerRegistrationBean.getStdcode1());

System.out.println("value of a:"+a);

employerRegistration.setStdcode1(a);

c=Integer.parseInt(employerRegistrationBean.getTelephone1());

System.out.println("value of c:"+c);

employerRegistration.setTelephone1(c); %>

[1334 byte] By [java@mania] at [2007-11-27 5:58:57]
# 1

wolud like add to my previous mail.

I am making an insertion to sql database .i am fetching the values from the master table to registration.jsp pages.

i also want to implement ajax for drop down menu option for district and state .as the district is selected the state should be automatically be shown.But what will be good for a web based project using -- javascript or ajax is the best option.as this is a web based project.

Do advice so that i can follow and improve my self.

or u can provide suggestion that will be help ful to me in future too.

waiting for the reply.

java@mania at 2007-7-12 16:34:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Please try to interpret the exception message:Attempted a bean operation on a null object.

If you don't understand it, googling on the exact message might help a lot.

http://www.google.com/search?q=%22Attempted+a+bean+operation+on+a+null+object.%22

You should have learnt from the results that the given bean name does not exist or the bean is not instantiated.

BalusCa at 2007-7-12 16:34:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

But the problem is that till yesterday it was not giving this error Null pointer exception it was giving.

And today its giving Attempted a bean opration on a null object.

So i am really confused as to why its giving such an error

and if the bean he is not getting that file should give error during compile time only.

java@mania at 2007-7-12 16:34:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Maybe because you accidently have inserted one space too much or so?
BalusCa at 2007-7-12 16:34:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

hi ,

Thanks for ur reply.

You are really very marvellous.I think u have lots of years of experience .

hats off to you.

Thanks

will really distrub u .

for all silly mistakes .

And i will surely learn many things from u.

will coming soon with other ? too.

java@mania at 2007-7-12 16:34:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
Hey do you has setting up all the JAR files correctly? does you use JDBC driver on your bean?
newBiea at 2007-7-12 16:34:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7

hi

yes i the connection to db is possible .

I have correctly put all the jar files properly.

No,i never use thw jdbc driver on my bean .it is always kept seperately in a connection package where the method for connection is done.All the drivers and the url is specified.

whenever a query is to be fired i use this connection package class to connect and fire the query.

java@mania at 2007-7-12 16:34:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8

Hi BalusC,

now the output its giving is really different fron the one given before.

org.apache.jasper.JasperException: null

i am not exactly what it wants to say but i am getting the values in the console ,when i am trying to print those values.

what should i check now. Do help

java@mania at 2007-7-12 16:34:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...