freelanceprogrammers.org Forum Index » Java

database & beans & jsp


View user's profile Post To page top
super_pj_girl Posted: Tue Feb 12, 2002 5:10 am


Joined: 09 Feb 2002

Posts: 21
database & beans & jsp
I was wondering where do i put my sql statements in the beans... with set or get
methodes? <br>where do i execute them , that my question...
Reply with quote
Send private message
View user's profile Post To page top
mcconnell_stephen Posted: Tue Feb 12, 2002 5:53 am


Joined: 01 Feb 2002

Posts: 73
database & beans & jsp
It depends upon how you are using the
beans.<br><br>I`ve used several different architectures, but I`ve
never used the set method to put the SQL into a
bean.<br><br>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.<br><br>I would pass the information
required by the SQL statement to the page which had the
bean and a &lt;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.<br><br>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...<br><br>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...<br><br>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.<br><br>Pi? Are you doing
this project by yourself, or do you have a mentor?
<br><br>What I would suggest is that you get the Wrox Press
book Professional JSP`s 2nd edition
<br><a
href=http://www.amazon.com/exec/obidos/ASIN/1861004958/qid=1013471215/sr=2-2/ref
=sr_2_2/002-5232411-8070453
target=new>http://www.amazon.com/exec/obidos/ASIN/1861004958/qid=1013471215/sr=2
-2/ref=sr_2
_2/002-5232411-8070453</a><br>(or maybe that`s the book you said was clear as
mud...) or <br>Jason Hunter`s Java Servlet Programming
<br><a
href=http://www.amazon.com/exec/obidos/ASIN/B00005UL4E/qid=1013471317/sr=1-20/re
f=sr_1_20/002-5232411-8070453
target=new>http://www.amazon.com/exec/obidos/ASIN/B00005UL4E/qid=1013471317/sr=1
-20/ref=sr_
1_20/002-5232411-8070453</a><br><br>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...<br><br>Good Luck... <br>I hope this
helps and isn`t too confusing.<br><br>Stephen McConnell
Reply with quote
Send private message
View user's profile Post To page top
super_pj_girl Posted: Thu Feb 14, 2002 9:55 pm


Joined: 09 Feb 2002

Posts: 21
database & beans & jsp
Thanx a lot!<br><br>But I kinda figure it out
now... JAVA is such a difficult language to learn, esp.
cos of the books that I needed to get for my class...
It goes from beginner`s level of JAVA to the next
book which is the advanced - intermidiar level of JAVA
with a lot of codes... and with very lil` explanation
unfortunately! <br>JAVA does have more standard classes and
stuff to make things easier, but it doesn`t really help
when u have NO IDEA how it is implemeted or what it
does... <br>ah well... I better get a move on with my
project... or I`ll never finish it in time!
Reply with quote
Send private message
View user's profile Post To page top
spooge21 Posted: Thu Feb 14, 2002 11:38 pm


Joined: 14 Feb 2002

Posts: 50
database & beans & jsp
I find the Java syntax itself to be fairly easy
to learn and understand, but it is true that there
are a huge number of classes in the Java API. The
best thing is to always have a copy of the JavaDoc for
the Java API on hand - preferably a local copy since
you will look at it a
lot!<br><br>Sincerely,<br>Anthony Eden
Reply with quote
Send private message
View user's profile Post To page top
mcconnell_stephen Posted: Fri Feb 15, 2002 12:25 am


Joined: 01 Feb 2002

Posts: 73
database & beans & jsp
The cool thing about PJ is that she wants to know "why" and isn`t looking for a
cookbook solution....<br><br>Stephen McConnell
Reply with quote
Send private message
View user's profile Post To page top
spooge21 Posted: Fri Feb 15, 2002 8:54 am


Joined: 14 Feb 2002

Posts: 50
database & beans & jsp
Agreed - that is cool. The cool thing about Java
is sometimes you don`t need to know how something is
implemented, rather you only need to know its interface. Not
really related, but an important concept of Java,
IMHO.<br><br>:-)<br><br>-Anthony
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help