I need to display the data requested by the user from the database on my jsp page.How can I do it using java beans?
A:
java beans
is not a library. It's more like a concept/design pattern for special classes, that hold attributes and provide getter and setter method, which use a naming convention. A quick example:
private String name;
private String street;
public getName() {return name};
public setName() {this.name = name};
public getStreet() {return street};
public setStreet() {this.street = street};
Now we can design a bean that corresponds to a database table. We just use the columnnames as fieldnames and have a java object that represents a table entry.
Have a look at DAO/DTO patterns and ORM (like JPA or hibernate). Those 'implement' this kind of technique and I'm pretty sure, one of those will help.
Andreas_D
2010-06-22 06:18:10
I have used beans to enter uer data into database.But i am not able to use it to retrieve data from the database.
bhavna raghuvanshi
2010-06-22 06:37:16
Sounds like you're already using some sort of framework and have a specific problem. Show some code and maybe we can provider better help :)
Andreas_D
2010-06-22 07:19:00