--- Lynn Guy <[EMAIL PROTECTED]> wrote:
> The issue is that the "poor sod" who doesnt know it
> all coming in has 2 stovepipes.  Struts and SQLServer
> (or some other db).  How does one get started when the
> app requires data from a database? 

Write and test classes that perform the business logic needed for your
webapp.  These classes will know about a DataSource object that let's them
talk to the database.  The DataSource is ideally configured in the app
server and looked up with JNDI.

Then, write Struts Actions that take form input and transfers it to your
business logic classes.  The Struts code you write will have no knowledge
of the way your data is stored.  The code from step 1 will be reusable
outside of Struts or even a web environment.

Your initial question would have been better phrased as something like,
"How do you architect a Struts database application?" instead of referring
to specific database products.  Also, some background on how much you
already know would help us know where to start explaining things.

David


> Maybe struts
> shouldnt know about the database, fine.  But struts is
> in the mix so there must be an
> approach/mechanism/something that gets the data to the
> page.  Its not magic so where is the discussion of
> approaches to maintaining struts "ignorance" of the db
> while getting my organizationId from the db to the
> page?????
> 
> So far I've got:
>   check out the datasource
>   check some sort of configuration in the webserver
>   check out object-relational mapping
>   check out JDBC
> 
> the rest is to my imagination and if I get it wrong
> you all will be right there to point it out to me
> later why I shouldnt have done that!  
> 
> sorry, but its a pain in the (&*&&%(& to learn and its
> even harder when all the discussions ignore how the
> pieces fit together because they arent supposed to
> know about each other!  Sounds like a catch22 to me.
> 
> --- David Graham <[EMAIL PROTECTED]> wrote:
> > 
> > --- Mark Lowe <[EMAIL PROTECTED]> wrote:
> > > 
> > > On Wednesday, October 8, 2003, at 07:30 PM, David
> > Graham wrote:
> > > 
> > > >
> > > > --- Mark Lowe <[EMAIL PROTECTED]> wrote:
> > > >> Godfrey
> > > >>
> > > >> I think what folks are trying to say is that
> > the SQL stuff is
> > > separate
> > > >> to the struts stuff, and this is kind of what
> > its about. There is a
> > > >> data source definition that confuses the hell
> > out of people new to
> > > >> struts as it seems to implicitly suggest that
> > it should be used.
> > > >>
> > > >> However most of the folks advise against its
> > use as it encourages
> > > >> breaking with MVC.. That said, there are
> > examples in the
> > > documentation
> > > >> and if you're used to quick dirty SQL in html
> > pages then using struts
> > > >> even when breaking MVC is still progress.
> > > >>
> > > >> You'll want some JDBC references and google
> > will find you some.
> > > >>
> > > >> when you've got the hang of doing SQL (JDBC)
> > stuff in your struts
> > > >> flavored webapp. I really dont know why folks
> > get so snobby about
> > > >> people breaking with MVC to get started..
> > > >
> > > > I wouldn't describe the responses as "snobby". 
> > The question was 
> > > > confusing
> > > > because Struts has nothing to do with SQL Server
> > or database access in
> > > > general.  You can code JDBC in Struts actions
> > just like a normal 
> > > > Servlet
> > > > app.  There is no "Struts way" to do database
> > access.
> > > 
> > > I know that, you know that, some poor sod with
> > SQLServer and obviously 
> > > little java experience perhaps doesn't. The
> > datasource configuration in 
> > > struts config does can lead to folks think there
> > is..
> > 
> > I agree, and that's one reason I think the
> > <data-source> configuration
> > should be deprecated and removed.  It served its
> > purpose in the beginning
> > but now IMO Struts really has no business dealing
> > with DataSources at all.
> > 
> > David
> > 
> > > 
> > > 
> > > >
> > > >> The funny thing is its the
> > > >> same folks recommending JSTL which have SQL as
> > part of the lib.
> > > >
> > > > That's like saying you shouldn't use JSP because
> > it lets you create
> > > > confusing scriptlets.  You don't have to use the
> > JSTL's sql tags just 
> > > > like
> > > > you don't have to use JSP scriptlets for them to
> > both be good
> > > > technologies.
> > > 
> > > I guess what I said could be read like that.. But
> > tags aren't the same 
> > > as embedding java in your jsp's. At least you can
> > port the java code 
> > > out of jsp's,  and the java is still java. The
> > stuff you learn using 
> > > scriptlets is useful across the board and thus
> > perhaps less of a waste 
> > > of time. If you used SQL tags then what use is
> > that? Where you going to 
> > > go with them?
> > > 
> > > So no sorry, its not like saying scriptlets are
> > bad for this reason, 
> > > its really quite different.
> > > 
> > > Mark
> > > 
> > > >
> > > > David
> > > >
> > > >>
> > > >> When you've done all that and you've seen what
> > a pain it can be, 
> > > >> you'll
> > > >> naturally arrive at the point where you'll hate
> > SQL and be gagging
> > > for
> > > >> an object-relational bridge. But I'd worry
> > about this when you get
> > > >> here..
> > > >>
> > > >> Hope this helps
> > > >>
> > > >> Mark
> > > >>
> > > >> On Wednesday, October 8, 2003, at 05:26 PM,
> > Lynn Guy wrote:
> > > >>
> > > >>> Let's restate the question...
> > > >>> I'm new to struts and my database is SQL
> > Server.  Can
> > > >>> someone point me in the correct direction
> > where to
> > > >>> find out how to set up an environment that
> > utilizes
> > > >>> these two to build an application?
> > > >>>
> > > >>> --- David Graham <[EMAIL PROTECTED]>
> > wrote:
> > > >>>>
> > > >>>> --- Jayson Falkner <[EMAIL PROTECTED]>
> > wrote:
> > > >>>>> Hi Godfrey,
> > > >>>>>
> > > >>>>> I can't think of any, but I'm positive you
> > would
> > > >>>> get some pointers if
> > > >>>>> you asked the Struts user list. I'll send a
> > copy
> > > >>>> this to the list.
> > > >>>>>
> > > >>>>> Does anyone know of a good Struts tutorial
> > that
> > > >>>> also deals with using
> > > >>>>> SQL Server?
> > > >>>>
> > > >>>> They are completely unrelated topics.  Struts
> > > >>>> actions should never know
> > > >>>> where you're getting your data.
> > > >>>>
> > > >>>> David
> > > >>>>
> > > >>>>>
> > > >>>>>
> > > >>>>> Thanks,
> > > >>>>>
> > > >>>>> Jayson Falkner
> > > >>>>> [EMAIL PROTECTED]
> > > >>>>>
> > > >>>>>
> > > >>>>> On Tue, 2003-10-07 at 15:10,
> > [EMAIL PROTECTED]
> > > >>>> wrote:
> > > >>>>>> Hey Jayson,
> > > >>>>>>
> > > >>>>>> Know any decent struts tutorials when using
> > it
> > > >>>>>> on top of SQL Server?
> > > >>>>>>
> > > >>>>>> Hope all is well.
> > > >>>>>>
> 
=== message truncated ===


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to