i am a student i am doing a jsp project for my J2EE module.I choose a auction web site 4 my project. I have a doubt Can I use the java beans into a Servlet.I uses the Beans into my Jsp Page by using USEBEAN but how can i use the sanme bean into a Servlet.????.
Please Reaply me.
Thanks
thabo

Read and understand the java tutorial first of all.
You seem to have no grasp of what a javabean is, which means you don't understand the basics of the language.

Read and understand the java tutorial first of all.
You seem to have no grasp of what a javabean is, which means you don't understand the basics of the language.

i didnt yet understand what is bean...i also show some tutorials....can you give a small explanation about bean and how it is differ from servlet?and give and example for a form processing

JavaBeans are Java classes which adhere to an extremely simple coding convention. All you have to do is to implement java.io.Serializable interface, use a public empty argument constructor and provide public getter and setter methods to get and set the values of private variables ( properties )

Sample Example Code:

public class SimpleBean implements java.io.Serializable {

	/* Properties */
	private String name = null;
	private int age = 0;

	/* Empty Constructor */
	public SimpleBean() {}

	/* Getter and Setter Methods */
	public String getName() {
		return name;
	}

	public void setName(String s) {
		name = s;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int i) {
		age = i;
	}
}

Thank u Sapna Suresh.. But i have a doubt can we invoke some other user defined method into the beans?.Because you said the bean is a java class.... i want to make validation to my inputs..it means ,for an example i passes all the input value to a bean from the form i have made.i want to validate my inputs..can you explain this senario??please give a example cording for your explain...

Thank u Sapna Suresh.. But i have a doubt can we invoke some other user defined method into the beans?.Because you said the bean is a java class.... i want to make validation to my inputs..it means ,for an example i passes all the input value to a bean from the form i have made.i want to validate my inputs..can you explain this senario??please give a example cording for your explain...

Then you should seriously pick up some book and start learning as jwenting already recommended as you obviously do not have essential background

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.