Newbie question - MVC model and Accessing Database and resultset bean?

E

Evrim

Hello

I have recently started reading about MVC model. From what I have
understood, the servlets will take care of business logic and jsp is in
charge of presentation and beans hold the values. Whatever example I have
come across so far , deals with beans that handle types like string or int.

What I would like to do is to use my servlet to get the resultset from
database and store the resultset in a bean - then this bean will be accessed
by JSP (through get property) to be displayed.

Could you please inform me if there is a way to do this ? or this process is
not possible with respect to resultsets and session beans with set and get
property methods ?


Thank you very much in advance.....
 
L

Lew

Evrim said:
Hello

I have recently started reading about MVC model. From what I have
understood, the servlets will take care of business logic and jsp is in
charge of presentation and beans hold the values. Whatever example I have
come across so far , deals with beans that handle types like string or int.

What I would like to do is to use my servlet to get the resultset from
database and store the resultset in a bean - then this bean will be accessed
by JSP (through get property) to be displayed.

Could you please inform me if there is a way to do this ? or this process is
not possible with respect to resultsets and session beans with set and get
property methods ?

It's not only completely possible, it's downright common.

You will need a layer of "Data Access Objects" (DAOs), either explicitly coded
or declared via the Java Persistence API. These will extract your data and
copy them into the beans that represent your object model. You then use these
"entity" beans to feed your business process logic.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top