Re: Newbie question - MVC model and Accessing Database and resultset
bean?
Evrim wrote:
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.
--
Lew