> I doubt anyone wrote something like that and I would refrain from writing
it
> myself too.  This goes against good design practices.

So does JSP, but people use it because it gets work done.  Regardless of
where you write your code (in a servlet, DatabaseAccess class, bean, etc.)
you still have to:
1) set parameters of preparedStatements
2) validate updates with business rules
3) create a list of variables (based on column names) in an html/template
page. (No JSP)

Having a class to generate the skeletons for this would be very beneficial
in saving time and reducing syntax errors. I would love to see an
implementation that does it all by magic without me having to model the
entire business in an application server. Your suggestion does not
accomplish this even though you might believe it does.

Lance


> Look at your code and factor out common things (database access,
validation,
> etc.).  Create common database pool for all your servlets.  Create a class
which
> has methods for executing queries,
> updates that returns a generic ResultsBean that you can use in JSP.
>And maybe a one dispatcher servlet that will handle
> validation and then forward request to worker servlets.
> With those things in place writing new servlets that access database will
be
> trivial:
>
> - get new DatabaseAccess class
> - create the query from submitted request, determine whether it's search
or
> update or something else
> - crate new ResultsBean
> - get results:  ResultsBean = DatabaseAccess.search(query)
> - put that bean in some context
> - forward to JSP
>
> thankyoudrivethrough
> dave.
>
>
> Lance Braud wrote:
>
> > Every servlet that I write that accesses a database I have to write code
for
> > it to get and set each of the resultset fields, prepared statement
> > parameters, and html form fields.  Add validation to each of those as
well.
> > Does anyone know of a java package that can read a ResultSet and
generate
> > servlet source code and a basic html form for viewing and updating the
> > resultset?  If not, I'm going to have to write one and I'd be interested
in
> > hearing your ideas on what something like this should include so it
would be
> > useful to others. Has anyone come up with a good way to accomplish this
> > already?
> >
> > Thanks,
> > Lance
> >
> >
___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> --
> David Mossakowski              [EMAIL PROTECTED]
> Programmer                           212.310.7275
> Instinet Corporation
>
> "I don't sit idly by, I'm planning a big surprise"
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to