Dave,

I can tell you that "Core J2EE Patterns" would be a good place to start. It
is an excellent book and draws on lots of real-world experience of the
writers. It shows how JSPs fit into the overall architecture and even
includes some code samples to get you up and running. Highly recommended.

  >>-----Original Message-----
  >>From: Dave Feltenberger [mailto:[EMAIL PROTECTED]]
  >>Sent: Friday, August 03, 2001 3:30 PM
  >>To: JRun-Talk
  >>Subject: RE: Querying the Db
  >>
  >>
  >>
  >>Speaking of the MVC architecture, can anybody share their 
  >>experiences with
  >>it, what they like about it, what they don't, etc.?  We're 
  >>about to start a
  >>fairly good sized JSP project soon, and we're going to use the MVC
  >>architecture - the problem is, none of us have ever done a 
  >>JSP project
  >>(we've done many ColdFusion projects and back-end Java 
  >>projects, just no
  >>JSP), and our company isn't willing to hire someone at this 
  >>point.  I'm
  >>experienced with servlets and Java in general, I just need 
  >>help with the
  >>architecture and separation of business from display logic 
  >>in JSP.  Can some
  >>of you experts point me in the correct direction and give 
  >>me some pointers?
  >>Thanks.
  >>
  >>--
  >>Dave Feltenberger
  >>[EMAIL PROTECTED]
  >>[EMAIL PROTECTED]
  >>
  >>
  >>> -----Original Message-----
  >>> From: Haseltine, Celeste [mailto:[EMAIL PROTECTED]]
  >>> Sent: Friday, August 03, 2001 2:54 PM
  >>> To: JRun-Talk
  >>> Subject: RE: Querying the Db
  >>>
  >>>
  >>> Gunter,
  >>>
  >>> Your understanding of what is "viewable" to the client should
  >>> they selected
  >>> the "view source" option in their browser window is correct.
  >>> Only the HTML
  >>> code and JS code is visible, the JSP code, include calls to
  >>> the db, is not.
  >>> The statement given below about separating db calls and other
  >>> server side
  >>> related functions from the presentation view (code) is the
  >>> "proper" way to
  >>> develop JSP's, particularly for long term maintenance of
  >>> code.  I believe
  >>> the term for this design is MVC architecture.  But in
  >>> reality, you will
  >>> often mix your code, especially if you are using a tag
  >>> library, as in the
  >>> example I gave several emails below.  In the real world 
  >>(which we all
  >>> unfortunately live in), the architecture you use is 
  >>really up to the
  >>> timeframe you have to develop/test/deploy your product,
  >>> coupled with the
  >>> total number of developers you have assigned to the 
  >>project and their
  >>> skill/experience levels.  I have worked in many shops where
  >>> the release date
  >>> of the product was viewed as the higher priority vs the design,
  >>> maintainability, and reliability of the product.
  >>>
  >>> Celeste
  >>>
  >>> -----Original Message-----
  >>> From: Gunter Sammet [mailto:[EMAIL PROTECTED]]
  >>> Sent: Friday, August 03, 2001 11:05 AM
  >>> To: JRun-Talk
  >>> Subject: RE: Querying the Db
  >>>
  >>>
  >>> I'm still a beginner in JSP/Servlet, but since I posted the
  >>> sample here a
  >>> question about hiding the code:
  >>>
  >>> If I understand right, since JSP resides on the serverside,
  >>> an HTML page
  >>> gets generated and sent to the client. So there is no way 
  >>for somebody
  >>> requesting the jsp, to see the code residing in the jsp. Or?
  >>> Could you give me an example how you would modify the code
  >>> below, using
  >>> custom tags?
  >>> TIA Gunter
  >>>
  >>> -----Original Message-----
  >>> From: [EMAIL PROTECTED]
  >>> [mailto:[EMAIL PROTECTED]]On Behalf Of 
  >>Matthew Horn
  >>> Sent: Friday, August 03, 2001 9:18 AM
  >>> To: JRun-Talk
  >>> Subject: RE: Querying the Db
  >>>
  >>>
  >>> Also bear in mind that while it is possible to include Java
  >>> code for db
  >>> access in your JSP, it is generally not recommended since 
  >>JSP's real
  >>> strength is that it allows you to hide the code from HTML
  >>> developers and use
  >>> abstractions such as custom tags.
  >>>
  >>>   >>-----Original Message-----
  >>>   >>From: Haseltine, Celeste [mailto:[EMAIL PROTECTED]]
  >>>   >>Sent: Friday, August 03, 2001 10:52 AM
  >>>   >>To: JRun-Talk
  >>>   >>Subject: RE: Querying the Db
  >>>   >>
  >>>   >>
  >>>   >>Bert,
  >>>   >>
  >>>   >>The example below is a good example.  Do keep in mind that
  >>>   >>ADO has built in
  >>>   >>methods/attributes that hid much of the SQL functionality
  >>>   >>from and ASP/ADO
  >>>   >>programmer that JSP/SQL does not.  In other words, you have
  >>>   >>to do more work
  >>>   >>with/and understand cursors in JSP/SQL programming than you
  >>>   >>need to in
  >>>   >>ASP/ADO.
  >>>   >>
  >>>   >>Also, if you are using SQLServer as your database behind
  >>>   >>your JSP product,
  >>>   >>make sure that you purchase a Type III or IV (preferable)
  >>>   >>driver, and make
  >>>   >>sure that driver is up to date on the JDBC 2.0 specs.  The
  >>>   >>type of driver
  >>>   >>and the drivers functionality make a BIG difference when
  >>>   >>programming JSP
  >>>   >>projects with SQLServer.  Oracle and SQLAnywhere are
  >>>   >>already packaged with a
  >>>   >>Type IV JDBC driver, but MS, in their infinite wisdom
  >>>   >>(sarcastic statement),
  >>>   >>refuses to acknowledge Java and therefore does not provide
  >>>   >>a Type IV JDBC
  >>>   >>driver.  You have to purchase a third party driver, and the
  >>>   >>quality and
  >>>   >>functionality of these drivers for SQLServer varies widely.
  >>>   >> Using the
  >>>   >>JDBC-ODBC bridge with SQLServer in any production JSP
  >>>   >>application is NOT
  >>>   >>recommended!!!!
  >>>   >>
  >>>   >>Celeste
  >>>   >>
  >>>   >>-----Original Message-----
  >>>   >>From: Bert [mailto:[EMAIL PROTECTED]]
  >>>   >>Sent: Thursday, August 02, 2001 8:12 PM
  >>>   >>To: JRun-Talk
  >>>   >>Subject: Re: Querying the Db
  >>>   >>
  >>>   >>
  >>>   >>Thanks If I wanted to process or query the db via a form
  >>>   >>from the previous
  >>>   >>page would I use the similar concept?
  >>>   >>
  >>>   >>
  >>>   >>
  >>>   >>
  >>>   >>Bert
  >>>   >>
  >>>   >>
  >>>   >>
  >>>   >>----- Original Message -----
  >>>   >>From: "Gunter Sammet" <[EMAIL PROTECTED]>
  >>>   >>To: "JRun-Talk" <[EMAIL PROTECTED]>
  >>>   >>Sent: Thursday, August 02, 2001 7:50 PM
  >>>   >>Subject: RE: Querying the Db
  >>>   >>
  >>>   >>
  >>>   >>> Here a sample for a jsp page connecting to a DB:
  >>>   >>>
  >>>   >>> <html>
  >>>   >>> <head> <title>Listing the content of a 
  >>Database</title> </head>
  >>>   >>> <body>
  >>>   >>> <p> Content of the dealer database:
  >>>   >>> <table border=1 cellpadding=0 cellspacing=0>
  >>>   >>> <tr> <td> Shop  </td>
  >>>   >>>      <td> Street </td>
  >>>   >>>      <td> Country </td>
  >>>   >>>      <td> ZIP </td>
  >>>   >>>      <td> City </td>
  >>>   >>>      <td> Phone </td>
  >>>   >>>      <td> Fax </td>
  >>>   >>>      <td> EMAIL </td>
  >>>   >>>      <td> WEB </td>
  >>>   >>> </tr>
  >>>   >>> <%
  >>>   >>>   Class.forName("org.gjt.mm.mysql.Driver");
  >>>   >>>   java.sql.Connection connection =
  >>>   >>>
  >>>   >>java.sql.DriverManager.getConnection("jdbc:mysql://localhost
  >>>   >>:3306/yourDataba
  >>>   >>> se", "yourUser", "yourPassword");
  >>>   >>>   java.sql.Statement statement = 
  >>connection.createStatement();
  >>>   >>>   java.sql.ResultSet columns =
  >>>   >>statement.executeQuery("SELECT * FROM
  >>>   >>> dealer");
  >>>   >>>   while(columns.next()) {
  >>>   >>>     String shop  = columns.getString("dname");
  >>>   >>>     String street = columns.getString("dstreet");
  >>>   >>>     String country = columns.getString("dcountry");
  >>>   >>>     String zip = columns.getString("dplz");
  >>>   >>>     String city = columns.getString("dort");
  >>>   >>>     String phone = columns.getString("dphone");
  >>>   >>>     String fax = columns.getString("dfax");
  >>>   >>>     String email = columns.getString("demail");
  >>>   >>>     String web = columns.getString("dweb");
  >>>   >>>     %>
  >>>   >>>       <tr>  <td> <%= shop  %> </td>
  >>>   >>>             <td> <%= street %> </td>
  >>>   >>>             <td> <%= country %> </td>
  >>>   >>>             <td> <%= zip %> </td>
  >>>   >>>             <td> <%= city %> </td>
  >>>   >>>             <td> <%= phone %> </td>
  >>>   >>>             <td> <%= fax %> </td>
  >>>   >>>             <td> <%= email %> </td>
  >>>   >>>             <td> <%= web %> </td>
  >>>   >>>       </tr>
  >>>   >>> <% } %>
  >>>   >>> </table>
  >>>   >>> </body>
  >>>   >>> </html>
  >>>   >>>
  >>>   >>> -----Original Message-----
  >>>   >>> From: [EMAIL PROTECTED]
  >>>   >>> [mailto:[EMAIL PROTECTED]]On 
  >>Behalf Of Bert
  >>>   >>> Sent: Thursday, August 02, 2001 4:20 PM
  >>>   >>> To: JRun-Talk
  >>>   >>> Subject: Querying the Db
  >>>   >>>
  >>>   >>>
  >>>   >>> Is it possible to Query the db with Jsp like Asp 
  >>for example,
  >>>   >>>
  >>>   >>> Via the GetQueryString("parametername")
  >>>   >>>
  >>>   >>>
  >>>   >>> myid = someid
  >>>   >>> then do your Sql Statment etc.
  >>>   >>>
  >>>   >>> select * from my table where myid like id?
  >>>   >>>
  >>>   >>>
  >>>   >>> Bert
  >>>   >>>
  >>>   >>
  >>>
  >>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to