help

I have got this exercise and would be thankful if somebody could point me in the right direction .

Create a servlet that displays a list of customers (From the customer table of the database). Use the HTML table to organize the display.

Hint: Use a Java Bean, e.g. CustomerBean that has the fields of 慒irst Name? 慙ast Name?and 慏ate of Birth? And when the query returns the result set, you will need to populate each CustomerBean and add them to an ArrayList. Then return the collection object to the servlet, loop through the collection and display the result.

I have learnt to display data in an html table directly from a servlet connected to a database via jdbc. But I do not understand how to use a JavaBean to attain that as advised in the 'hint'.

[779 byte] By [suse69a] at [2007-11-27 4:54:04]
# 1

hi

bean must have get and set method

for example ur formcontains 2 cols named name and reg

ur bean must contain getName(); setName(); and similarly for reg field also so

u can invoke this method to retrieve value and print it using servlet the get and set method must be in following structure

public void setName(String name) {

this.name=name;

}

public String getName() {

return name;

}

regards

venkat

noveleraa at 2007-7-12 10:08:39 > top of Java-index,Desktop,Developing for the Desktop...