Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Harley Evans   on Feb 18 In Java Category.

  
Question Answered By: Lela Lynch   on Feb 18

It depends upon how you are using the
beans. I've used several different architectures, but I've
never used the set  method to put  the sql  into a
bean. One architecture I used (when I was just learning
JSP's) was to have a method in the bean that connected
to the database  and then made any database calls you
need. It then sets the information in the bean for the
JSP to extract. I would pass the information
required by the SQL statement to the page which had the
bean and a <jsp:setProperty ... tag would set the
required properites. Then I would call a "processInfo"
method where I did my DB work and set the infor needed
by the page in the bean. Ok, all you purists,
I know that totally Violates the MVC architecture,
but I was learning... I realize that the problem with
that approach was the view was tied closely with the
Model... In the long run it is difficult to maintain and
next to impossible to change... But for a quick page,
it worked and got all those "scriptlets" out of the
JSP... Now I use a multi-tiered approach. My JSP's only talk
to a "mediator" which could even be used in a Swing
App... The mediator talks to the domain classes and the
domain classes map to the data... I don't know
exactly what super_pi_girl is wanting to do, but the
quick approach I outlined above is just that a "quick
and DIRTY" way to do it. Pi? Are you doing
this project by yourself, or do you have a mentor?
What I would suggest is that you get the Wrox Press
book Professional JSP's 2nd edition
www.amazon.com/.../sr=2\
-2/ref=sr_2
_2/002-5232411-8070453 (or maybe that's the book you said was clear as
mud...) or Jason Hunter's Java Servlet Programming
www.amazon.com/.../sr=1\
-20/ref=sr_
1_20/002-5232411-8070453 Both those books talk about some good
architectures
AND have good examples to follow. Jason Hunter's book
goes into the details on the HTTP protocol, a little
on architecture and covers JSP's and JDBC.... AND
it's cheaper... Good Luck... I hope this
helps and isn't too confusing

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on database & beans & jsp Or get search suggestion and latest updates.


Tagged: